Rockin' JAX with Hashrocket

Hashrocket recently honored Joe Ferris (no relation) and I by an invitation to come down to Jacksonville Beach, Florida to work on one of their 321 Launch projects as guest star programmers.
Chris O’Sullivan actually did an amazingly accurate job of describing the project from a technical point of view by doing an impressively detailed analysis of our github commits and tweets.
We had a lot of things going for us in this project: The clients were a breeze to work with; Desi and Lark were both great developers, and a lot of fun to pair with; and the end product, Spot.us was going open-source – meaning there was no room for “cowboy antics” (Desi’s words).

The client was very impressed with the progress we had made, and with the overall polish of the site. You can read more about the reaction here, and the demo video is below.
Working at Hashrocket was a lot of fun, and in many ways was the perfect vacation. You’re surrounded by talented coders (which fends off the normal vacation boredom), and you get to wake up to beautiful beach views every morning.

Mememe

- Take a picture of yourself right now.
- Don’t change your clothes, don’t fix your hair…just take a picture. (should be super-easy with Photobooth)
- Post that picture with NO editing.
- Post these instructions with your picture.
(It’s “formal friday”)
Testing named_scope
We’re huge fans of NamedScope here at Thoughtbot. It does wonders for finder reuse and clarity. Unfortunately, it also creates a large number of finders that all must be tested, where the old method may have only created one.
To help out with the testing of simple named_scope definitions, we added a helper to Shoulda, should_have_named_scope:
class User < ActiveRecord::Base
named_scope :old, :conditions => "age > 50"
named_scope :eighteen, :conditions => { :age => 18 }
named_scope :recent, lambda {|count| { :limit => count } }
end
class UserTest < Test::Unit::TestCase
should_have_named_scope :old, :conditions => "age > 50"
should_have_named_scope :eighteen, :conditions => { :age => 18 }
should_have_named_scope 'recent(5)', :limit => 5
should_have_named_scope 'recent(1)', :limit => 1
end
Now for complex methods, where the options returned by the has_finder are hairier than a simple limit or a single column condition, we would also write black box tests. But this helper is great for those simpler calls.
Quick vim svn blame snippet
Just to prove the theory that every incredibly incomprehensible piece of code you come across is probably your own, I penned a quick svn blame vim command.
vmap gl :<C-U>!svn blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR>
Just highlight the disgusting code in question, and bask in your own shame!

Getting back into the swing of things.
The past three weeks have been a total whirlwind of excitement, glamour, drinking, more glamour, sickness, boredom, and a bit more glamour.
I gave a presentation on BDD with shoulda for Mountain West Ruby Conf in Salt Lake City (video above).

It must be nice to live in a city completely surrounded by gorgeous snow capped mountains. And the library where the conference was held was an incredible example of architecture. Lots of sweeping curves and generous amounts of glass.
After that, it was off to present at Scotland on Rails. I’ve never been to a city as thoroughly beautiful as Edinburgh. It seemed like every street was lined with buildings older than my own country.
I’ll be putting the shots I took for both of these trips up on my flickr account as soon as I have time to unload them.
Unfortunately, I fell under the grips of a serious cold at the end of that trip, and just finished recovering last weekend. So now it’s time to get back up to speed.
I’ll be in New York next weekend for GoRuCo, Brisbane on the 9th for some personal time, San Diego on the 23rd for more of the same, Portland on the 29th for RailsConf, and Portland again in July for OSCON, where I’ll be giving a 3 hour tutorial on advanced ruby metaprogramming.
In fact, I’ve got so many trips planned this season, that I’ve started using Dopplr to keep track of them. Check out my profile and itinerary in the sidebar, stage left.
And I promise to get back to more technical posts as soon as the dust settles.
Email your Backpack GTD items
Like most kids out there, I’m a follower of the GTD system. I’ve gone through a bunch of GTD software and have boiled it down to a combination of Backpack and a pad of paper in my hip pocket.
I thought I’d share a script I wrote that emails me my list of todo items every morning.
First off, my backpack GTD system is pretty straight forward:
- A page for each context, the names of which start with ’@’ – so @work, @phone, @online, @zipcar, @home, @blog, etc.
- Each context page includes a single list named “Tasks”
That’s about it. I’ve also got a someday/maybe page, and a page for each major project, but those don’t get emailed to me.
Download this script, change the constants at the top, and plop it on a server somewhere. You should test it on the server it will live on by running /usr/local/bin/ruby /home/tsaleh/bin/email_todos.rb
Then setup your crontab to run that sucker every morning. My crontab looks like this:
@daily /usr/local/bin/ruby /home/tsaleh/bin/email_todos.rb
That should be it. The next morning you’ll get a list of the tasks you have to complete for each context.
