Exploratory Ruby-magic with the iRuby Notebook

Learning the programming language Ruby can be a wonderful experience. The language is elegant and well-designed, promoting the use of eloquent and very human-readable programming constructs. Also, it speaks to my aesthetic sense in its syntactic simplicity and no-nonsense approach.

Personally, I learned Ruby through why the lucky stiff’s “The Poignant Guide to Ruby”, the Rails handbook, the Ruby Pickaxe book, and a lot of chatting on IRC. At the time there weren’t that many available screencasts (and no MOOCs), which, fortunately, has changed since then.

I like the idea of learning new programming languages ever so often, as it expands and enriches my way of thinking and creativity related to problem solving in the software domain.

Learning can be done in a lot of ways, and I have found that note-taking is an important activity for efficient learning during my personal learning endeavors. However, I’ve always felt like there was some gap between the notes I was taking about programming and the code and examples that I wanted to go with them to completely support my comprehension (especially after some time). You know, runnable code and notes intermixed.

Sure, you can make a Ruby-script and insert a lot of comments, but I’m more of the aesthetic type, so I wanted to be able to throw different fonts, graphics etc. in there. What to do?

Lo and behold! On the O’Reilly Strata + Hadoop World conference in New York, iPython and iPython Notebook was presented, and was is exactly what I have been longing for: Notebooks mixing HTML/Markdown, graphics and, not least, runnable Ruby code.

While installing iPython I ran into some problems, so here’s an end-to-end installation guide using Brew on Apple OS X:

 $ mkdir iruby # Create a new directory
 $ echo 'iruby' > iruby/.ruby-gemset # Define the Gemset to use
 $ echo 'ruby-2.2.0' > iruby/.ruby-version # Define the Ruby-version to use
 $ cd iruby # cd into the directory
 $ brew install zeromq # Install the libzmq dependency
 $ sudo pip install ipython pyzmq jinja2 tornado # Install Python dependencies
 $ gem install iruby pry rmagick rubyvis gruff # Install iruby and other Ruby goodness
 $ iruby notebook # Start iRuby Notebook
 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>