Posts Tagged ‘ tricks ’

Interesting Object Methods in Ruby

Monday, September 27th, 2010

This little Rubyism is something that I use frequently for debugging my objects. I add a method to every object to show only the interesting methods. What do I mean by interesting methods?

Creating Configuration Files With Ruby Templates

Wednesday, June 30th, 2010

I recently had a very repetitive configuration file that needed creating. There were approximately 50 config blocks of 10 lines each with only the host name changing with each block. So I decided to take a shortcut and do it in Ruby using ERB templates. This is so easy and literally save me hours worth of work.

Git Command Aliases

Monday, December 28th, 2009

This is kind of a tip of the day, but I just think its cool so I am sharing it with everyone. And being a recent convert to Git and the fact that I have to use Subversion at my place of work, I find myself constantly doing things like this out of habit.

$ git st  && git ci

Well now I can do that (although it may not be a good idea) with git alias:

elubow@beacon (master) supportskydivers$ git config --global status
elubow@beacon (master) supportskydivers$ git config --global commit
elubow@beacon (master) supportskydivers$ git st && git ci
# On branch master
nothing to commit (working directory clean)

Now st and ci are git aliases for status and commit respectively.

Git Branch Name in Your Bash Prompt

Friday, December 11th, 2009

I work with a few repositories at any given time. And during that time, I typically have multiple branches created for each repository. I figured that it would make my life easier if I knew which branch and/or repository I was working in. Luckily, very little hackery is required here since the git distribution already comes with such a tool. (Note: If you didn’t build Git from source, then you may not have this file.)