Dont Panic

Runlevel6

Where Am I?

Runlevel 6 is an international group of like-minded individuals who have come together to learn from, and contribute to the development community.

Recent Work

Screenshot

Letterland

Modern design and UI for the digital presence of Letterland Canada.

Search and Destroy

Mail Me

Get in Touch

Get your people to call our people. We'll do lunch sometime.

Case Sensitive to Insensitive

Gianni

February 14th, 2009

Today I was about to format my computer, but first I had to backup my files. So I dragged my home folder over to an external hard drive. Turns out the external drive was formatted as case-insensitive and my internal drive is case-sensitive (the true UNIX way). Anyway, the transfer failed because many of my files had the same name, just different case. I freaked out and thought that this would be impossible to fix. But then I remembered that I was a programmer, so I quickly wrote a couple ruby scripts to quickly find files with conflicting names.

I thought some of you might find these useful, so I’m posting them here:

casechecker

Code

Usage

./casechecker_recursive.rb /path/to/directory

PS

Never format your Mac as case-sensitive, you’ll have major compatibility issues. Trust me.

Automating Dictionary Lookups

Gianni

December 20th, 2008

This is a simple guide for automating dictionary lookups in Mac OS X. I constantly find myself looking up the definition of a word, or trying to find a synonym with the Dictionary app in OS X. But wouldn’t it be great if I could do this really easily from anywhere? Well you can!

Many people have long forgotton about the Services menu in OS X, which will take the currently selected text in any application – and do stuff with it. We’re going to be taking advantage of the Look Up in Dictionary action.

First, open up your Keyboard & Mouse preferences, and select the Keyboard Shortcuts tab.

Next you’re going to click the little plus button, to add your own keyboard shortcut. A dialog will appear; leave Application set to All Applications, set the Menu Title to Look Up in Dictionary (note: make sure it’s exactly that), and I set my Keyboard Shortcut to Control + Shift + Command + D.

That’s it! You’re done! Now from any application you can just select/hi-light a word and hit your shortcut, and it will automatically find it in the dictionary for you.

(Note: I am aware that there is already a “Look up in dictionary” shortcut in the system, however this shortcut does not work, for me at least.)

Automating The Development Environment

Gianni

May 11th, 2008

I’m a ruby developer, and every morning when I arrive at work I find there is a whole lot to do before I can actually begin coding. Here’s my list of morning chores:

  • Delete yesterday’s log files
  • Open several terminals
  • Update my code form the subversion repository
  • Start autotest, memcached, mongrel, and various other servers
  • Open my project in my editor

This can become very tedious when you have to repeat it every day, but thankfully it can be simplified into a 1-click process with Apple’s Automator. First things first, I need to delete my old logs. To do that I use the Get Specified Finder Items action and pass it to the Move Finder Items to Trash action:

Delete Logs

Next I need to update my working copy from the main repository. You might even have a couple projects that need updating. Again I use Get Specified Finder Items, but this time I pass it to a Run Shell Script action where I use subversion to update each of them:

Update Working Copy

At this point I’d like to open up Terminal.app, create a few tabs, and start my servers. Before we can use an Automator action, we need to grab a copy of terminit from ELC Technologies. Terminit is a cool little ruby script that lets us initialize Terminal.app tabs and commands to run in each tab. This is my terminit config file:

# Initialize Terminal
- tab1:
  - cd ~/Projects/rails/gigparkapp
  - memcached &
  - script/server
- tab2:
  - cd ~/Projects/rails/gigparkapp
  - rake facebook:tunnel:start
- tab3:
  - cd ~/Projects/rails/gigparkapp
  - autotest
- tab4:
  - cd ~/Projects/rails/gigparkapp


To execute our terminit config we need to use the Run Shell Script action again:

Terminit

Finally I need to open up my Textmate project so I can begin coding. I grab the Texmate project file with the Get Specified Finder Items action then pass it to the Open Finder Items action:

Textmate

Of course you can always throw in a few actions to spice things up a bit:

Webcam Fun

Or:

Growl Fun

All you have to do now is save your worlflow as an application and you’re done. I put my new application right in my dock so I can always access it quickly.

Dock Icon

Twitter

Follow me

Subscribe

Stay up to date with the RSS feed.

Flickr Feed