August 23rd 2010

Resque: how to requeue failed jobs

Today I found about 100k Resque jobs in the failed queue. Due to a small error in some user content, those jobs all failed. After fixing the problem, how do you reprocess all those jobs?

Option one: go to the resque-web backend and click retry about 100.000 times.

Option two: do some cool ruby commands…

August 9th 2010

Using multiple clipboards in Vim

On of the first things you learn when using Vim activly is that when you delete something using x or dd that content is actually cut and put on a clipboard. Later you can retrieve that content using the p or P commanands.

One thing that makes Vim more awesome than let’s say, uhm TextMate, is that it actually has more than one clipboard! Yeah! In fact, in Vim terminology those clipboards are called registers

August 9th 2010

Rename a git branch

In git, branching is cheap and easy. You do it all the time (you’re not? Well, you should). Sometimes, though, you create a new feature branch, only to come to the conclusion later that the name you gave it does not cover the stuff you’ve been doing.

No problem for git! Renaming a branch is really easy:

git branch -m old_branch new_branch

That’s all…

July 29th 2010

How to enable SSH Forwarding on Mac OS X Snow Leopard

The other day I was toying with Rubber to deploy a Rails3 app to Amazon EC2. I host the project code in a private Github repository, accessible only with my own SSH key…

July 12th 2010

Screencast: Firefly URL shortener in less than 2.5 minutes

Firefly is a light-weight URL Shortener app. It’s written in Ruby/Sinatra and can be easily deployed to Heroku, as I’ve written before. This screencast illustrates how easy it really is to setup Firefly and give it a spin. Did I mention that both Firefly and Heroku can be used for free?

Firefly URL shortener in less than 2.5 minutes from Ariejan de Vroom on Vimeo.

June 10th 2010

Cherry-Picking specific commits from another branch

I’m often asked how to merge only specific commits from another branch into the current one. The reason you’d want to do this is to merge specific changes you need now, leaving other code changes you’re not interested in right now behind.

First of all, use git log or the awesome [GitX][1] tool to see exactly which commit you want to pick. An example:

dd2e86 - 946992 - 9143a9 - a6fd86 - 5a6057 [master]
           \
            76cada - 62ecb3 - b886a0 [feature]

Let’s say you’ve written some code in commit 62ecb3 of the feature branch that is very important right now. It may contain a bug fix or code that other people need to have access to now. Whatever the reason, you want to have commit 62ecb3 in the master branch right now, but not the other code you’ve written in the feature branch…

June 7th 2010

Uploading files with Curl

I’ve always trouble uploading files with Curl. Some how the syntax for that command won’t stick, so I post it here for future reference.

What I want to do is perform a normal POST, including a file and some other variables to a remote server. This is it:

curl -i -F name=test -F filedata=@localfile.jpg http://example.org/upload

You can add as many -F as you want. The -i option tells curl to show the response headers as well, which I find useful most of the time…

June 6th 2010

Setup your own Firefly URL shortener in 2.5 minutes

By popular demand I’ve setup a guide to setup your own personal URL shortener with Firefly and Heroku. I’ve timed it an you can do it in under 2.5 minutes. How’s that for fast?

June 6th 2010

Firefly 0.4.3 and Firefly Client 0.4.0 released

Today version 0.4.3 of Firefly was released with some minor updates. To complete the package, a new gem firefly-client has been released.

The client library allows your Ruby application to easily shorten URLs with a remote Firefly server. It’s very easy to use and lightweight.

May 30th 2010

Upgrading to Mongoid Beta 6

If you are working with Rails 3 and Mongoid, you’re likely to upgrade to mongoid-2.0.0.beta6. That’s okay, but you will run into a few problems. Among others, one will be:

Database should be a Mongo::DB, not NilClass

or

Mongoid::Errors::InvalidDatabase: Mongoid::Errors::InvalidDatabase

Another, Mongoid-related problem is the error uninitialized constant OrderedHash.

Luckily, these problems can be solved quite easily.