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 https://github.com/pda/roflbalt

Fix Postgres permission denied issue on OSX Lion

The good thing is that Apple decides to bundle PostgresSQL 8.4 with OSX Lion which cause conflict if you install Postgres 9.x using brew or Macport. You will likely bump into following error:

    $ psql -d postgres -U postgres
    psql: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

So what’s going wrong here? Because the stock postgresql has higher precedence in PATH.

To fix this, simply make /usr/local/bin highest precendence for $PATH.

Local scope (recommended):
Edit ~/.bash_profile

export PATH=/usr/local/bin:$PATH

System-wide scope:
Edit your /etc/paths and move your /usr/local/bin to the top.

$ sudo nano /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Ruby Tip: Reference to previous line

Travis Winters showed me a nifty trick to reference to previous line in rib by using the symbol _ (aka underscore). Look at the example below:

$ irb
ruby-1.9.2-p290 :002 > "hello world"
ruby-1.9.2-p290 :002 > @hello = _
ruby-1.9.2-p290 :002 > puts @hello
hello world
 => nil

Ruby Tip: Fetch a terminal command output using bartick directive

If you need to extract text from a command output within Ruby, the bartick directive could come in handy.

Syntax is: `command`

One of the useful examples is to retrieve a path of a command:

gcc_path = `which gcc`

There are more applications, I guess I should leave it to you to discover.

Follow

Get every new post delivered to your Inbox.

Join 57 other followers