This past Tuesday evening I presented to the RubyAZ user group. The talk covered useful libraries and gems that I saw at Rails Conf 2012 that I thought others might find helpful in their day to day work. I’ve made the presentation slides available as a pdf. Enjoy!
by Irish on June 28, 2010
Alright, so you’ve switched to using rvm but when you run cmd+r on a Ruby file in TextMate you’re still using your old system install of Ruby… Luckily it only takes a few easy steps to setup TextMate to use your rvm environment.
1) First make sure your install of TextMate if updated
Textmate -> Preferences -> Software Update -> Check Now
2) Next make sure all your bundles are up to date. The creator of rvm, Waynee Seguin, provides a small bash script to automate this process. You can check it out at this GitHub gist
3) Now get the rvm name of the Ruby version you want to use in TextMate. In my case I’m going to use my currently selected version “ruby-1.8.7-tv1_8_7_174″
$ rvm list
rvm rubies
jruby-1.5.1 [ i386-java ]
ruby-1.8.7-tv1_8_7_173 [ i386 ]
=> ruby-1.8.7-tv1_8_7_174 [ i386 ]
ruby-1.9.1-tv1_9_1_378 [ i386 ]
ruby-1.9.2-head [ i386 ]
4) Then run the rvm command to wrap this ruby version for TextMate
$ rvm wrapper ruby-1.8.7-tv1_8_7_174 textmate
5) Now set a TM_RUBY variable in your TextMate Preferences
Textmate -> Preferences -> Advanced -> Shell Variables
To the wrapper command generated by rvm for you, in my case it was found here:
/Users/cirish/.rvm/bin/textmate_ruby
6) Since TextMate will use it’s own builder, by removing it, we can use TM_RUBY as described above.
$ cd /Applications/TextMate.app/Contents/SharedSupport/Support/lib/
mv Builder.rb Builder.rb.backup
7) Last but not least, quit TextMate and re-open it to load these settings. You should now be all good
by Irish on June 22, 2010
I seem to continually have the problem of my laptop waking up on its own in my backpack. I’m not sure what exactly is the cause, but I’m gonna assume it’s from the screen not staying completely locked/closed. However, I found this OS X command on Andrew Dupont’s blog, which puts OS X into a “safe sleep” mode. This causes OS X to write memory state to a hibernation image at sleep time. Now for me to awaken my Macbook Pro, opening the lid is not enough. Now it takes a press of the power button, and a few more seconds than before, but no more accidental awakening, or half-dead battery upon arriving at my destination.
$ sudo pmset -a hibernatemode 1
Now just put your computer to sleep like you normally would. I for one prefer to use the quick keys (cmd + option + eject). Check the man page for more options.
$ man pmset