Category Archives: ruby

Command finished notification with Ruby

I wanted a visual notification in Ubuntu when long running commands finished in Terminal. My solution, run the command and pipe it into notify. $ a-long-running-command | notify notify.rb Make it executable add an alias to it in ~/.bashrc Requires: ruby, rubygems, and libnotify. Similar solutions: “alert” alias (I’ll be switching to this in Maverick), […]

Also posted in code, ubuntu | Leave a comment

Ruby Duration

Download ruby duration lib Duration.new recieves a string describing a duration of time, and converts it into: seconds, and a standard readable format. Or, you can pass Duration.new an integer representing seconds, and receive the same standard readable format. Usage: Passing a String Passing an Fixnum (of seconds)   Example valid input strings: “2 weeks”, […]

Posted in ruby | 1 Comment

ruby csv to structured hash

I had a csv like this: object color flavor shape apple red sweet round banana yellow sweet long lemon yellow sour round and I wanted a ruby hash structured like this: So I wrote this, which does the job:

Also posted in rails | 1 Comment

Ruby conversion module

This is a ruby module useful for conversions dealing with length, weight, torque.

Also posted in rails | Leave a comment