Tag Archives: Coding
Rails 3 console and “no such file to load”
If you happen to load gems in your ~/.irbrc , make sure to add a gem dependency on them in your Rails apps’ Gemfile. For example, I just started using Awesome Print in IRB. However, when I ran rails console … Continue reading
Deploy a specific revision with Capistrano
Just about every website that I release, be it at work or at home, is stored in a Git repository, and deployed using Capistrano. I’ve been debugging this PHP application at work that was written by a 3rd-party. After cleaning … Continue reading
Matching Printable Characters
Who doesn’t love regular expressions? They’re fucking awesome. I use’em at least 10 times per day. Sometimes, there’re restrictions on what patterns you can use. I wanted to change a regex for validating passwords. Originally, it allowed letters, numbers, and … Continue reading
Displaying Your ViM Colour Scheme
I posted this mostly because I’m always forgetting it, and also because it’s a pain in the ass to search for on Google. I usually try “:echo g:colorscheme”, which fails miserably. If you’re playing around with colour schemes in ViM … Continue reading
Hashes and Frozen Keys
The hash class freezes keys that are strings: This can be a problem if you want to use those keys later on…more specifically, if you want to extract and edit those strings: Unfortunately, those strings will have to be duped … Continue reading
Sinatra and Passenger/mod_rails
If you want Apache to serve up a Sinatra app, your best bet is to use Passenger (AKA mod_rails). All your app needs is the usual Rackup config file (config.ru) in the app’s root directory, and the directory public/ . … Continue reading
Ruby in Etch
As some of you may know, Ruby and Debian’s ways of packaging software go together like Darwin and religious zealots…as in, they don’t. So how should you install Ruby when using Debian Stable? How do you stay up-to-date with new … Continue reading
Default stegosaurses
Ever heard of Jonathan Viney’s active_record_defaults plugin? It’s fantastic. In a nutshell, it enables you to specify default values for model attributes. If an attribute isn’t set when initialising a new instance, the attribute’s set to whatever the default value … Continue reading
Friends don’t let friends code without tests
But what if your friends don’t write tests? Or what if you’re just lazy? Well, if the latter applies, that’s your own damn fault. But if nobody around you tests their code, you’re probably not going to be motivated to … Continue reading
Testing…it’s what life’s all about
I just read a great call to action by John Nunemaker. He wants to see everyone writing tests for their code, and has decided to “post like a superhuman fiend until everyone is testing”. He’s on to something! With that … Continue reading