Archives for 2011

Using Passenger with RVM and Sinatra

Posted on: Apr 04 2011

After making the move to Linode (finally!) I had some issues with getting the contact pages on this site and Penderry up and running. RVM was throwing an error about the sinatra gem missing. A quick scan of the error message and it was obvious that Passenger wasn't using my gemsets.

A bit of googling turned up this little snippet which, when placed in app/config/, will tell RVM to use the gemset associated with the folder.

if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')  begin    rvm_path     = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))    rvm_lib_path = File.join(rvm_path, 'lib')    $LOAD_PATH.unshift rvm_lib_path    require 'rvm'    RVM.use_from_path! File.dirname(File.dirname(__FILE__))  rescue LoadError    # RVM is unavailable at this point.    raise "RVM ruby lib is currently unavailable."  endend

Nose Tests - no such option

Posted on: Apr 30 2011

Some time ago now I added proper command line options to Tv Renamr, followed shortly by a test suite with Python's Nose. Along the way I ran into a bug that has frustrated me for a long long time, until today when I finally found a work around - hooray, go me!

The bug is hardly a game stopper as it only affects the UI candy on my tests. Simply put, I couldn't use options with nose. Every time I did, an error was thrown saying no such option existed for nose while displaying the usage string for tvr:

Using Django formsets on a new section for a project at work I came across something I haven't considered before: adding new inline forms to a formset without reloading the page. Javascript was the obvious choice. Two pages required the functionality: one with six formsets, the other with one, which meant the solution needed to take into account formset prefixes. I found various solutions around the Internet, but all were outdated (lots of table based layouts!) or not generic enough (didn't deal with multiple formsets).

Setup Gitalist with Gitolite on Nginx

Posted on: Jul 24 2011

I recently gave Github's paid service a go when my vimrc ended up needing some passwords in it. While I'm a big fan of Github and what it's done for the Git community as a whole I just can't justify paying the £5 a month so I can use my vimrc at home, work and a few servers. Of course the downside is the loss of being able to quickly view code on the web, but as fate would have it Twitter came to my rescue within a couple of days via the sagely Joel Moss.

Diving into Gitalist there were a couple of surprises, least of all it's written in Perl. Perl?! That's a dead language right? (Unless you're slashdot). However playing around with the demo (guys, please up whatever server you're running that on, it's dire) was great, not to mention it looks really slick.

Ecohandle Shopping Bag

Posted on: Jan 08 2011

Ecohandle Shopping Bag

This year's Christmas Haul brought me an interesting little gem: The Ecohandle Shopping Bag. I got round to giving it a bit of a go today when I did a veg shop and thought doing a review on it would be fun.

So, first things first - what is it?

It's a shopping bag, duh. The bonus here though is that the bag part compacts down into the handle for when you're going to the shop. Nice and neat. If you feel like a real glutton for punishment on your forearms (I'll get to that properly in a minute) you can add extra bags. There are two slots with retractable clips that you can put the bags into, assuming you can carry them of course. I managed to get at least 5 kg into the Ecohandle bag alone without pushing it's limits! Getting it home was the bigger issue issue as I had to keep swapping hands when my grip muscles died.