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
The following shell command will crawl your hard drive, from your current directory, looking for any git repositories. When it finds them it will garbage collect, prune, and pack them, regaining your disk space and make your repositories operate faster.
1 2
| #!/bin/sh
find . -type d -name .git | while read dir; do pushd "$dir"; git gc --prune; popd; done |
You can run this directly from the terminal or just turn this snippet into a lil bash script file for easy executing later, i.e.
$ touch git_garbage_collect.sh
$ nano git_garbage_collect.sh
$ # copy & paste the script into the file
$ ctrl+o # to save the file
$ ctrl+x # to exit nano
Then just run it like any other bash script
$ ./git_garbage_collect.sh