Isaac Overacker

maker of things

Octopress Themes: Opening Links in a New Window

I just rolled out a change to the mnml theme to cause links to be opened in a new window. If you’re looking to do the same thing for your Octopress theme, it requires a simple change to the /source/javascripts/octopress.js file. Open that file and add the following to the $(document).ready() function:

    // You probably already have some code here.
    // Just add this to the end of the function.
    $('a').each(function() {
        var a = new RegExp('/' + + '/');
        if(!a.test(this.href)) {
            $(this).click(function(event) {
      , '_blank');

You could also do this in any web app that uses jQuery, of course.

(Hat-tip to Adri Kodde for posting a snippet about this.)

Managing Ruby Environments on OS X: Getting Started With Rbenv

If you’ve done any development on OS X, chances are you’ve run into various apps and tools that require different versions of Ruby. Manually installing and maintaining multiple versions of Ruby is a pain. Fortunately, there are tools to make this process easier. Rbenv is a lightweight, focused tool that helps you manage different versions of Ruby and switch between them as needed. You can even set the specific Ruby version for your app to keep your team on the same page.


There are several paths to installing rbenv. The simplest is to use homebrew. (If you don’t have homebrew, it’s easy to install. Go here.)

First, make sure your homebrew is up-to-date.

brew update

Then, install rbenv and ruby-build.

brew install rbenv
brew install ruby-build

Once it is done installing, you need to update your profile. This is generally ~/.bash_profile. Open it in your favorite editor, and add the following line.

eval "$(rbenv init -)"

Now execute that in your current bash session by using source.

source ~/.bash_profile

Rbenv will be setup and ready to use.

rbenv Basics

The only installation of Ruby that you will have in rbenv at this point is the system version. If you type the following command, it will show you what versions are installed.

rbenv versions

This will show an asterisk next to the version rbenv is currently using. To install a new version of Ruby, use the rbenv install command. For example, to install Ruby 2.0.0-p247:

rbenv install 2.0.0-p247
rbenv rehash

This will install version 2.0.0-p247 under ~/.rbenv/versions/. The rehash command tells rbenv about the new executables. You should use this command any time you install a new version of Ruby or install a gem that includes commands. (You can read about the rehashing process here.) You can use this version globally by using the global command:

rbenv global 2.0.0-p247

Or, if you’d like to specify that this version should be used in a specific directory, use the local command:

rbenv local 2.0.0-p247

This will create a file named .ruby-version in the current directory that states the version of Ruby to use while in this directory. Rbenv looks for this file when you use Ruby commands. This provides the ability to ensure everyone on your team is using the same version of Ruby when developing your app.

That’s it, you’re up and running with rbenv! For additional details and advanced features of rbenv, check out the official GitHub repository.