Jay McGavren's Journal

How a Head First author spends his days off

View on GitHub
2009-08-30

Linux Live Arcade?

You know, it wouldn’t be that hard to re-do the MythTV frontend system to be like XBox Live/Wii channels. Instead of shows, you’d flip through games available for download. When you found one you wanted, you could choose a menu entry to install it via the package manager.

Networking would be a little harder - you’d need a list of IP addresses for your friends/party members, which would then need to be fed to the command line for each game using that game’s options. I don’t think exiting back to the menu in the event of a connection failure could be made automatic in most cases, either, but that may not be a show-stopper.

I’m on this train of thought because I’m a little tired of dumping money into these locked-down ecosystems that I know will go away as soon as my console dies. I know I can’t attract people to play open-source games when the consoles are so much better integrated, so anything that ties a few titles together can surely help. There were some efforts in this regard a few years back, but I haven’t heard anything of them since…

Read more...
2009-08-29

i_object.png

Read more...
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...
2009-08-21

Don't blame me, blame @bm5k.

@bm5k a,b,c,d,e=" bottles of beer","on the wall"," Take 1 down pass it around ",a+b,d+c;(1..99).map{|i|"#{i}"+d+" #{i}"+e+"#{i-1}"+d} #songsincode

Resulted in:

99 bottles of beeron the wall 99 bottles of beeron the wall Take 1 down pass it around 98 bottles of beeron the wall

99 bottles of beeron the wall 99 bottles of beeron the wall Take 1 down pass it around 98 bottles of beeron the wall

98 bottles of beeron the wall 98 bottles of beeron the wall Take 1 down pass it around 97 bottles of beeron the wall

Which resulted in:

beer.mp3

Read more...
2009-08-20

#songsincode #songsintests

In response to a Twitter meme… Sarah McLachlan’s “Ice Cream”.

require 'test/unit'

class TestYou < Test::Unit::TestCase
  def test_you
    you = Object.new
    ice_cream = Object.new
    assert you.love > ice_cream
    anything_else = Object.new
    assert you.love > anything_else
    here = ['a', 'b']
    here.each {|body| assert_respond_to(body, :fight)}
  end
end

Read more...
2009-08-20

Physics...

Video here.

    set_manager :physics, create_game_object(:BasicPhysicsManager)

    spawner = create :GameObject, :ReceivesEvents
    load_keymap :MouseKeymap
    spawner.handle_event :mouse_pressed do |message|
      object = create :GameObject, :Physical
      object.set_physical_debug_mode true
      case rand(2)
      when 0
        object.set_shape :Box, 10, 5
      when 1
        object.set_shape :Circle, 10
      end
      object.body_position = message.value.pointer
    end

Read more...
Copyright © Jay McGavren.