Andy Waite

Software Development Consultant, Ruby and Rails Developer, Toronto

Goodbye Octopress

29 April 2015

I moved to Octopress several years ago but I’ve always found it somewhat confusing. I’ve now switched to using plain Jekyll via GitHub Pages. Things may look a little rough at the moment.

Opening new panes in tmate

01 March 2015

tmate is a fork of tmux for easily setting up a remote pairing session. When using normal tmux, I have the following configuration so that new panes and windows remember the previous working path:

bind-key - split-window -v  -c '#{pane_current_path}'
bind-key \ split-window -h  -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'

I recently tried remote pairing in tmate for the first time. It was confused as to why my new panes and windows were opening in the top level / instead of the previous pane’s path.

It turns out that pane_current_path is a tmux 1.9 feature, but tmate is based on tmux 1.8. There’s some talk of a 1.9 version, but it seems to have been delayed.

The workaround I’ve found is to use -c "$PWD" instead. Make sure to use double quotes so that it gets interpolated. You can add that to ~/.tmate.conf to override the existing setting in ~/.tmux.conf.

Coding Offline

12 March 2014

Looking things up online while coding is now so common that we take it for granted. Need to check the parameters for that method call? Just Google it. How do you configure that library? Check the README on GitHub. What does that obscure error mean? Look it up on StackOverflow, someone else has probably already solved it.

But there will be times when you want to code, and you don’t have an Internet connection. You might be on a 14-hour plane trip – what a great way to do some coding without distractions! But then you discover there’s some critical piece of documentation you need, and you can’t make any progress without it.

So the next next day, you head to a local coffee shop, and connect to their WiFi. But you soon discover it’s slow and unreliable. You return to your hotel, and discover there’s a huge surcharge for in-room WiFi because it’s priced at business travellers with expense accounts.

So in desperation you buy a local SIM card, add some credit, and tether your phone to your laptop. But you discover the 3G network doesn’t have good coverage in the part of town you’re in. Web pages keep timing out causing endless frustration.

But it doesn’t have to be this way. In this post, I’ll show some practical tools and techniques to turn coding offline into a viable practice. Even if the above situations don’t apply to you, it can sometimes be good to disconnect on purpose to avoid all the interruptions and distractions that being online brings.

Preventing Accidental File Deletions

02 March 2014

Many of us learned the hard way that rm and rmdir are unforgiving. There’s no Trash to recover from, and there’s no undo.

There are many legendary stories involving rm -rf disasters.

In time you learn to be wary of using those commands, but once in a while you’ll screw up and delete something you shouldn’t have.

There are a few articles about how to alter the behaviour of rm so that it moves to the trash instead of permanently deleting. But this is dangerous if you happen to be using a different machine which doesn’t have this behaviour enabled.

A better option is to install rmtrash (also available via Homebrew). The rmtrash command can be use to delete both files and directories, and as the name suggests it moves the files to the Trash instead of parmanently deleting them.

If you really need to call rm or rmdir then just provide the full path, e.g. /bin/rm or /bin/rmdir.

You can then alias the actual rm commands to give you a reminder warning, for example add this to your .bashrc:

alias rm="echo 'Use rmtrash, or full path name for rm'"
alias rmdir="echo 'Use rmtrash, or full path name for rmdir'"

Over time this should get you into the habit of typing rmtrash.

This change might cause problems with shell scripts which use rm. I’m not really sure how to deal with that. It may be sensible for the alias to return false to indicate the command failed.

Reference: Apple StackExchange post

Coding Tour: TableXI, Chicago

20 November 2013

TableXI are based in a spacious loft-style office in the West Loop area of Chicago. The place has lots of nice touches highlighting the history and culture of the company, such as the recreation of their logo using just pins and string:

Logo