Jay McGavren's Journal

2009-08-27

Robert Frost once defined poetry as that which cannot be translated. No wonder anime and manga arrive in the US with the poetry removed.

Read more...
2009-08-26

Quick HOWTO for Hirb formatter for irb/Rails console...

Hirb is pretty object formatting for irb (and the Rails console). If squinting at the standard Object#inspect output is slowing you down (trust me, it is), you should look into Hirb. Here’s <5 minute setup…

Install the gem:

sudo gem install hirb

Add these lines to your $HOME/.irbrc file, which will cause Hirb to be auto-loaded at startup for both irb and script/console:

require 'rubygems'

require 'hirb'
extend Hirb::Console
Hirb::View.enable

Try it out in irb:

$ irb
irb(main):001:0> table ['foo', 'bar']
+-------+
| value |
+-------+
| foo   |
| bar   |
+-------+
2 rows in set
=> true
irb(main):002:0>

Try it out in script/console:

jay@dandelion:~/Projects/myproject
$ script/console
Loading development environment (Rails 2.3.2)
>> MyModel.all
+----+-----------------+-------------------------+-------------------------+
| id | name            | created_at              | updated_at              |
+----+-----------------+-------------------------+-------------------------+
| 1  | Foo             | 2009-06-16 23:38:10 UTC | 2009-06-16 23:38:10 UTC |
| 2  | Bar             | 2009-06-17 00:38:16 UTC | 2009-06-17 00:38:16 UTC |
+----+-----------------+-------------------------+-------------------------+
2 rows in set

Hirb has customization options I haven’t even begun to explore, so be sure to look at its docs.

Read more...
2009-08-24

I love VMs.

picture-1.png

Read more...
2009-08-24

FAIL... whale?

picture-2.png

Read more...
2009-08-22

Album version...

#songsincode

class Bitch
  def love(person)
    puts person
  end
end
bitches = [Bitch.new, Bitch.new, Bitch.new]

me = Object.new
me.instance_eval {def rock; 'the projects'; end}

bitches.each do |bitch|
  bitch.love(me) if me.respond_to? :rock
end

Read more...