Andy Waite

Contract Ruby, Rails, JavaScript and iOS Developer

Coding Offline

Permalink

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 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 will discover there’s some critical piece of documentation you need, and you can’t make any progress without it.

The next day, you might go to a local coffee shop, and make use of 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, probably 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 you 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.

Dash

Dash is a paid app published by Kapeli which lets you download documentation for offline use. It’s US$19.99 but can occasionally be found at a discount. It covers virtually every language and framework you might want refer to, and the content is updated automatically.

Dependency Management Tools

A dependency manager such as Bundler or npm will download all the libraries your projects needs, based on a manifest file. If you add a dependency, it will need to fetch that from the Internet, unless it’s already on your system (and is at the correct version number).

You’ll probably find that most dependencies are added or changed near the beginning of a project, and that changes become less frequent over time. So this is a case where preparing beforehand is key, while you still have a fast Internet connection. If you’re beginning a new project, start by building a minimal feature that touches all layers of the system, so that you can discover any missing dependencies.

Once you have the dependencies installed, you may need to refer to their documentation. People tend to jump straight to the project’s web site, but all the documentation is usually already contained with the packages you’ve downloaded. For example, if you’re using Ruby you can simply run yard server -G Gemfile within your project, then visit http://0.0.0.0:8808 to browse it.

Distributed Version Control

We take it for granted, but Git is a huge help when working offline. Older systems such as Subversion require a connection to a server to view a file’s history, or create a new branch. When you clone a Git repo, you’ll have the full history of every change that’s been made.

Feature branches are particularly useful. If you get stuck on a problem due to not being online, you can commit what you’ve have so far, then check out a separate branch from master to work on something else.

Books

I use to have a fairly large collection of paper books, but I’ve given that up now for the convenience of having everything just a click away.

While technology-based books do tend to be become outdated fairly quick, they can be a useful addition or replacement for the standard documentation.

I’m a big fan of companies which allow you to download their books in mulitple formats (usually PDF, epub and mobi), without DRM. This includes Pragmatic Programmers, Leanpub, Manning and O’Reilly.

I store my eBooks in Dropbox, and use GoodReader to keep them in sync with my iPad. I prefer to read PDF versions on the iPad since it preserves the author’s intended layout. Code samples can be difficult to read on a Kindle.

eBooks don’t take up much disk space, so you carry every book you own without having to be concerned about disk space.

Email

If you’re working on a project with other people, you might need to refer to information contained in emails. Unfortunately web-based mail such as GMail are no use when offline. So consider using a native email client which can download and store all your mail offline, such as Apple’s Mail app for Mac.

Even if you have many years of email, it shouldn’t take up too much space as long as you periodically prune any mail with large attachments. I have around five years of mail in GMail which consumes only around 3GB.

StackOverflow

StackOverflow has become indispensible to many developers. The entire question and answer database is available under a Creative Commons license on The Internet Archive.

The raw data probably isn’t much use, so check out StackStash (US$1.99), an iOS app which allows browsing of the entire StackOverflow site offline.

Evernote

I love Evernote for keeping notes organised, but one of its most useful features is the Web Clipper. Whenever I look-up something which I think I might need to refer to later, I clip the page into Evernote. This allows me to view it offline, with all formatting intact. It’s indexed by Evernote so I can easily find what I’m looking for, even within thousands of notes.

I also recommend maintaining ‘cheat sheets’ of common commands you use, or things you have trouble remembering without Googling them.

Video Content

I’m a big fan of screencast tutorial sites such as Railscasts and Codeschool. These can be streamed online but I like to have them available to refer to offline.

Videos can take up a lot of space, so you may want not want to fill up your drive, especially if you’re using an SSD with limited storage.

Instead, store the videos on a secondary device whch you can carry with you. A 128GB flash drive or card can be bought for around US$60. If you want more space, a portable 2TB USB hard drive is only around $100, and sturdy enough to carry around in your bag.

Did you find this post useful? I’m writing a book on Travel Technology. Sign up to learn more.

Prevent Accidents With Rm and Rmdir

Permalink

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

TableXI, Chicago

Permalink

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

The coolest time to visit must be summer, when they run their own rooftop cinema on top the building!

The office design includes a professional kitchen. A chef cooks the team lunch each day, which encourages everyone to spend time together.

Kitchen

They’re very supportive of the Chicago software development community, and sponsor or host many events:

Chalkboard

They often have guests working in the office, so today I was grateful to pair with Zack Briggs of Test Double. He was working on a Chrome plugin using Angular.js for measuring JavaScript performance.

Below is a bunch of miscellaneous notes, observations and links from today:

  • Logitech Conference Cam
  • Lo-Dash is a Underscore.js replacement, with benefits including faster performance
  • Backbone tends to be significantly slower than Angular or Ember - you can see this on the TodoMVC site after adding about 30 items.
  • Angular’s use of additional attributes may feel awkward at first, but it means there’s almost never a need to add IDs or classes solely for behaviour
  • Angular’s ng-repeat makes dealing with collections much cleaner than using subviews
  • The use of the pipe character (|) in Angular seems slightly odd at first - StackOverflow post
  • Backbone.js has nicely annoted source
  • NPM solves the problem of competing dependencies by having multiple copies of a dependant library. Rather different from RubyGems.
  • Sometimes code can be “so DRY that it’s chafing”
  • Dev Bootcamp, another Chicago company.
  • Backbone.js: .listenTo vs .on to avoid phantom views
  • Chrome Canary can be a useful sandbox if you’re building an extension and don’t want to mess up your main browser
  • Alfred, an alternative to QuickSilver, LaunchBar, etc.
  • An Intervention for ActiveRecord
  • Some recommended Destroy All Software episodes covering VIM and shell: Processes and Jobs, File Navigation in Vim, The .vimrc
  • All the Vim you need to get started and be productive can easily fit on an index card
  • I knew some of the common Bash keyboard shortcuts, but I never realised they were inspired by emacs. You can also set bash to use vi mode.
  • Golden Gate Ruby Conference 2010 - Workflow - Ryan Davis
  • Nobody will train you but you - Zach’s talk from RailsConf 2013
  • Oh My ZSH
  • Consider setting your shell prompt to indicate a dirty index or untracked files (see this StackOverflow post)
  • When you set a breakpoint in JavaScript, you can hover over variables to see their current state
  • When your pair with someone, you often learn more about improving your workflow than improving your coding

Thoughtbot, Boston

Permalink

Thoughtbot’s office is next to the scenic Boston Common, and was just a short walk from my hotel.

I first met with Anna, Thoughtbot’s office manager, who gave me quick tour and introduced me to Josh Clayton, one of Thoughtbot’s managing directors. Coincidentally I’d just heard Josh speaking on the Giant Robots podcast while I was on the flight over.

Josh had been working on a feature for factory_girl, a testing library which I was already familiar with. The create_list method can sometimes be abused, so they’ve decided to add a create_pair method to encourage people to only create a minimal number of test objects. We talked about the best way to test this against the various build strategies and shortly later committed b9e1dd. A great start to the day!

Next up was the daily standup. It’s pretty fast-paced, with about 30 developers involved. Fridays are usually reserved for working on open source projects, or learning a new technology, kind of a ‘20% time’.

I then paired with Joel Quenneville, building a basic Ember.js app from scratch, without involving any Rails stuff. We had quite a few “Ok, this works, but it shouldn’t work!” moments, and overall we both discovered a few new things about Ember.

Lunch at Thoughtbot is catered in-office on Fridays, so I got to meet a few more of the team.

After lunch I paired a bit more with Joel, adding ember-data, and then with Tony DiPasquale on some iOS code for TDAudioPlayer. It was interesting to see all the improvements to Objective-C and XCode since I last used it (I tend to use RubyMotion).

Friday afternoons at Thoughtbot ends with a round-table tech discussion. The topic this week was Rails engines, which I’ve used but aren’t deeply familiar with, but it was interesting to hear the lively argued discussion.

I met Ben Orenstein who I knew of through the Giant Robots podcast and his conferences talks.

The day finished with drinks and dinner at some local bars.

Overall, a great start to my tour! Thanks to everyone at Thoughtbot for being so welcoming.

The Coding Tour Begins

Permalink

So after the past several months of planning, and a few hectic weeks of moving out out of my apartment, I’ve at last set off on my World Coding Tour. I’m writing this from a hotel room in Boston, where I’ll be visiting ThoughtBot tomorrow.

I’ve had an awesome and enthusiastic response to the tour, and I’m grateful to everyone who’s helped spread the word, especially Corey Haines and Avdi Grimm, who helped to spread the word. I’ve had offers from all over the US. Rather than try to arrange every date up front, I’m going to schedule as I go. RubyConf is coming up this weekend, so that should be a good opportunity to find some companies to visit.

Promoting My Coding Tour

Permalink

Previous Post: My Coding World Tour

I announced plans for my Coding World Tour in a previous blog post. The next challenge is to make sure people know about it.

Other than a couple of posts on Twitter and a share on LinkedIn, I haven’t yet done much promotion. This post describes my next steps for spreading the word.

Personal Network

I know a handful of people in some of the cities on my list, so I’ll be asking them to share my post with their local contacts.

 Regional User Groups

Every city I plan to visit has a least one Ruby or Rails user group. I think these will probably be my best bet for finding coding opportunities:

It might seem wrong to focus on Ruby, but it has an incredible community. Also, many Ruby developers are polyglot programmers, so it may lead to a chance of exploring other languages.

Ruby Forums

These forums are full of enthusiastic developers:

Individual Companies

There are a number of companies I admire who I’d like to spend a few days with, so I may approach them directly, but I’m going to hold off and see what offers I get first.

Other Publications

These would be harder to get a mention on, but would be great publicity: