Duplo

Building Blocks & Learning Experiences

Browsing Posts in Software

I ran across a really obscure and subtle bug in Ruby 1.9, which was triggered by RSpec including a module for the purpose of altering RSpec::Mock objects before they’re serialized to YAML. I was attempting to update a work project from REE 1.8.7 to MRI 1.9.3. Some of the tests were failing with a SystemStackOverflow: [...]

Rxvt-unicode (aka urxvt) has been my terminal of choice in Linux these days. Since I like to use the keyboard as much as possible, I found it frustrating that I couldn’t paste from my clipboard into urxvt without having to use the middle mouse button. I searched for a solution to this problem, and found [...]

I was having some trouble running rspec within Emacs. One of the gems in my Gemfile was pointing to a git repo, and as a result, bundle was shelling out through Emacs to check my revision using this method: def revision_from_git if File.exists?(scope(‘.git/HEAD’)) Dir.chdir scope(“.”) do `git rev-parse HEAD` end end end Since my git [...]

If you happen to have a <select> tag with its multiple attribute set, you can unselect them in Cucumber by adding this step: When /^(?:|I )unselect “([^"]*)” from “([^"]*)”$/ do |value, field|   unselect(value, :from => field) end

The uservoice gem provides a nice easy way to integrate your Rails app with the UserVoice user feedback service. If you’re using Heroku to deploy your Rails app, there are two things that will provide speed bumps. The first is that, short of storing your UserVoice API key in your git repository, there’s no way [...]

This post is a reminder to myself, that when I upgrade my webrat gem, I need to replace its vendor/selenium-server.jar. If I forget, then Selenium Remote Control will most likely break because the version of selenium-server.jar included with webrat is old, and doesn’t support current versions of Firefox.

I’ve often been sad that there is no default keybinding for comment-region in Emacs’s ruby-mode. Eventually it annoyed me enough that I added one: (add-hook ‘ruby-mode-hook (lambda () (define-key ruby-mode-map “\C-c#” ‘comment-or-uncomment-region) ) ) This assigns C-c # to comment the current region, or if the current region is already commented, it will uncomment the [...]

Autotest-inotify is a gem that extends autotest to use Linux’s inotify to monitor changes to your source and test files, running the appropriate tests as files are modified. By default, autotest implements filesystem polling to detect these changes. This can use a significant amount of CPU cycles1, and can impact battery life in laptops. Through [...]

In the process of setting up metric_fu, I found that, one way or another, saikuro’s output wasn’t getting into the correct place. I’ll spare you the long story, and just show the config settings I had to put into my Rakefile to get things working: config.saikuro = { :output_directory => “#{ENV["CC_BUILD_ARTIFACTS"]}/scratch/saikuro”, :input_directory => ["app\" --input_directory [...]

When my wife recently pointed me to an article by Jim Weirich about Dependency Injection (DI), one of my first thoughts was, “how is this different from the Abstract Factory (AF) pattern?” So I did some searching and found a brief comment from Martin Fowler: If you have multiple ways to construct a valid object, [...]