Deploy Spree 1.0 on Heroku

I am in the process of moving my digital house to the new Octopress-based, there are many things to clean up and migrate but I guess for now I will do double-post on this site and the new site.

Please head to if you want to read my tutorial on how to deploy Spree 1.0 on Heroku

How to access gcc and other build tools of Xcode 4.3 or newer in console

Apple announced Xcode 4.3 for OSX Lion and 4.4 for OSX Mountain Lion last week. The major difference is that Xcode no longer provide an installer which is good thing because you now could update Xcode with AppStore in the future, plus it is much easier to carry the development environment with you. However, there is a little problem with this new version of Xcode, is that all command line toolsets and compilers are not visible in terminal. A simple fix is to update your PATH env:

export PATH=/Applications/$PATH

Please be noted that clang does not reside in /Developer/usr/bin, it is now in /Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Now you could access to gcc, g++, git or any toolsets bundled with Xcode. For your convenience, it is recommended to include it in your .bash_profile.

Specify precision and scale attributes for decimal number with scaffold/model/migration generators in Rails 3.2.0

By using the short hand  :decimal{precision, scale}, rails generator lets you generate number migration with decimal and scale. You could use {precision, scale} or {precison-scale} or {precision.scale} shorhand:

rails g scaffold Product title:string price:decimal{8,2}

the above would generate a migration of:

t.decimal :price, :precision => 8, :scale => 2

NOTE: sadly, this feature is so broken as of the release of 3.2.0 and is addressed in the bug #4602.

Happy Lunar New Year!

Happy New Year to all friends and readers. You guys have been, are and always be my inspiration to write and contribute to the great Ruby community. I would like to take this opportunity to extend my wish to all of you a year of Dragon full with prosperities, wealths and lucks.

Introduction to The Suicidal Jumpman Ruby game aka ROFLBALT

Hi folks, the last 3 days were MADLY fun for me @ Railscamp X (Adelaide). I was blown away with beers, whiskey, Werewolfs, foods, geeks, hackers and their SUPERCOOL hacks. Dennis Hotson (@dennishotson) and Paul Annesley (@pda) decided to join force to create a game that if was released before Mario, it would probably take on the world. (Unfortunately it was 25 years later). The game goal is to sustain alive by jumping on the top of the building as long as possible.

It is interesting to see the progress that Paul and Dennis made, from such few characters to draw the man (not knowing jumping yet) and build blocks to animated jumpman chasing the helicopter which blasted to pieces if bumped into buildings (/w blood trails on the building). Paul and Dennis called the game ROLFBALT, for me I would call it the Suicidal Jumpan for its bloody ending scene. I rank this game 2nd after the Wolf3D clone Rubystein. Give it a try now at

Replace Honda Accord Euro MY05 Battery

This year is the worst year of my life, everything is breaking down. And just a week before X-Mas, my car battery decided to retire after 5 years of hard work. So I started venturing into the World Wide Web to find a best replacement part. After digging into few forums, all recommended to go for ACDelco 430 or Supercharge Gold MF75****. It turns out that those batteries does not fit perfectly with my Accord Euro MY05. Besides, they are quite expensive too ~ around $150 AUD. In the end I called up John Blair Honda Parts and got a good deal for the Supercharge Silver SMF55D23L for $130. Off I went to pick it up and quickly got my dead battery replaced. Now my car roar like a real lion with a full 500CCA (the stock part is 300CCA though). I think I should hit the road now 🙂

Open Cubic Player (ocp) is now available under Homebrew for all MacOS X

For whom who doesn’t know what Open Cublic Player (ocp) is, this application is a pure console music player for DOS and *NIX based platform. It was one of the most popular app of the DOS era. Though lacking mouse control and a graphical user interface, many hackers/developers still prefer it to other GUI music players for its light overhead and rich features.

Today, I am delighted to announce that ocp Formula is officially committed into Homebrew repository. I’d like to thank Stian for the great app and for being patient with me on many emails back and forth on fixing nested functions compiling issues with gcc on OSX. To all console lovers out there, you can start trying out this great app right now:

$ brew update
$ brew install ocp
$ ocp

Bugs reports are greatly welcomed. Enjoy!

Best way to read codes before you sleep

Before I go to bed, I force myself to read code on my laptop while laying on bed. I normally lie down sideway facing left or right so I am more comfortable reading code that is vertically rotated. Thanks to Vico text-editor orientation feature, I could set the Orientation to Vertical and all codes are now vertically rotated for me.

Quantum talk by Damian Conway @ YOW 2011

Damian is a truly world-class speaker. His talk on Temporally Quaquaversal Virtual Nanomachine Programming In Multiple Topologically Connected Quantum-Relativistic Parallel Timespaces is very inspiring. I’d recommend you to check that out once the talk video is up online.

Multi-line comment with Ruby

line 1 blah blah
line 2 blah blah