Month: March 2008

New naming scheme for Rails Partials?

Posted by – March 11, 2008

I personally dislike the current naming scheme of partials. Right now they follow the format of _somepartial.html.erb (Rails 2.*). I find it rather distracting and hard to find what I want when I am in a directory full of partial files following that naming format.

My suggestion is to use .perb for partials. I think files like somepartial.html.perb would be much more pleasant to look at, a kind of syntax sugar to encourage more usage of partials perhaps. Also, I think it would be a more consistent naming scheme.

Vote for somepartial.html.perb ;)

Using multiple versions of rubygems

Posted by – March 9, 2008

I was trying to figure out how to run a specific version of a gem, in this case, capistrano. I had capistrano 2.2.0 and 1.4.1 installed and I wanted to run the older version.

Trying to run /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.4.1/bin/cap only gave me an error:
undefined method `execute!' for Capistrano::CLI:Class (NoMethodError).

Turns out the trick is to use:
cap _1.4.1_ deploy

I haven’t tried it with other gems, but I am guessing it should be consistent across rubygems and that will be the way to execute older versions of ruby gems.

Reproduction in math?

Posted by – March 9, 2008

28384376 * 1024 = 29065601024

The 1024 is repeated in the answer. I initially thought it was a bug in my program, but double-checked, and I thought it was pretty cool how the 1024 ends up at the end, with a buffer (the zero) between it and the rest of the number.

Perhaps alife could be done entirely using numbers and math operations.

Bash script to remove deleted files from git

Posted by – March 7, 2008

for i in ` git st | grep deleted | awk ‘{print $3}’ ` ; do git rm $i; done

How to tie your shoelaces really fast

Posted by – March 6, 2008

I just figured this out from YouTube and made my very first video by using my macbook’s built-in webcam and the iMovie HD software that comes with Mac OS X. No worries, I’m not a Mac fanboy, that’s just what I happen to have.

Fast Version:

Slow Version:

Download (right click with mouse & choose ’save as’): fast | slow