Jay McGavren's Journal

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...
2009-08-19

Logan put together a pretty impressive container for Jemini (note the rename for Google-ability) demos. Just pick from a menu to load a state. Showing a description? One line. Offering running updates on a variable’s value? One line.

class AudibleState < Gemini::BaseState

  def create_ui
    text "Click in different places in the window to emit a sound at different pitches and volumes."
    watch('Pitch') { @pitch }
    watch('Volume') { @volume }
  end

  def load
    
    set_manager :sound, create(:SoundManager)

    audible = create :GameObject, :Audible, :ReceivesEvents
    
    audible.load_sound :boom, "boom.wav"
    
    load_keymap :MouseKeymap
    
    audible.handle_event :mouse_pressed do |message|
      @pitch = message.value.pointer.x / 100.0
      @volume = message.value.pointer.y / 100.0
      audible.emit_sound :boom, @volume, @pitch
    end
    
  end
end

Read more...
2009-08-19

:)

Aquarius lyrics Artist: Boards of Canada

yeah thats right

ORANGE

yeah thats right

ORANGE

giggle

one ORANGE (Just Fantasize) two three

Read more...