Jay McGavren's Journal

How a Head First author spends his days off

View on GitHub
2009-10-03

MetaGenerator...

I’m getting an insane amount of variety out of very little code.

picture-39.pngpicture-38.pngpicture-37.png

picture-36.pngpicture-34.png

require 'rubygems'
require 'wx'
require 'rubyonacid/factories/meta'
require 'rubyonacid/factories/flash'
require 'rubyonacid/factories/increment'
require 'rubyonacid/factories/loop'
require 'rubyonacid/factories/random'
require 'rubyonacid/factories/sine'
require 'rubyonacid/factories/skip'



class MyApp < Wx::App

  WIDTH = 480
  HEIGHT = 480

  def on_init
 
    @f = RubyOnAcid::MetaFactory.new
    @f.factories << RubyOnAcid::FlashFactory.new
    @f.factories << RubyOnAcid::LoopFactory.new
    @f.factories << RubyOnAcid::RandomFactory.new
    @f.factories << RubyOnAcid::SineFactory.new
    @f.factories << RubyOnAcid::SkipFactory.new
    
    @resetter = RubyOnAcid::SkipFactory.new(0.999)
    
    #Containing frame.
    frame = Wx::Frame.new(nil, :size => [WIDTH, HEIGHT])
    frame.show
 
    #Displays drawing.
    window = Wx::Window.new(frame, :size => [WIDTH, HEIGHT])
 
    #Animate periodically.
    t = Wx::Timer.new(self, 55)
    evt_timer(55) {animate(window)}
    t.start(33)
 
  end
 
  def animate(window)
     window.paint do |surface|
       surface.pen = Wx::Pen.new(
           Wx::Colour.new(
             @f.within(:red, 0, 255).to_i,
             @f.within(:green, 0, 255).to_i,
             @f.within(:blue, 0, 255).to_i,
             @f.within(:alpha, 50, 255).to_i
           ),
           @f.within(:width, 1, 5).to_i
       )
       surface.draw_line(
          @f.within(:x, 0, WIDTH).to_i,
          @f.within(:y, 0, HEIGHT).to_i,
          @f.within(:x2, 0, WIDTH).to_i,
          @f.within(:y2, 0, HEIGHT).to_i
       )
     end
     @f.reset_assignments if @resetter.boolean(:reset)
  end

end

app = MyApp.new
app.main_loop

Read more...
2009-09-30

Guess I'm freaking amazing, then...

We are all motivated by a keen desire for praise, and the better a man is, the more he is inspired to glory.

-Cicero

Read more...
2009-09-19

Yeah, suck it, Kafka!

picture-23.png

Read more...
2009-09-19

Oh, for Pete's sake...

This is what my evening has been like…

Spec::Mocks::MockExpectationError in 'ResourceManager#load_resources with global assets loads gif files'
# expected :cache_image with (:test, "test/data/loads_png/test.png")
but received it with (:gif, "test/daUnknown type of file: test/data/state_specific/.DS_Store
Unknown type of file: test/data/state_and_global/.DS_Store
ta/loads_gif/gif.gif")
./src/managers/resource_manager.rb:19:in `load_resources'
./src/managers/resource_manager.rb:11:in `each'
./src/managers/resource_manager.rb:11:in `load_resources'
test/unit/managers/resource_manager_spec.rb:38:

Grumble, grumble… fix

Spec::Mocks::MockExpectationError in 'ResourceManager#load_resources with global assets loads gif files'
# expected :cache_image with (:test, "test/data/loads_gif/test.gif")
but received it with (:gif, "test/data/loads_gif/gif.gif")

GRUMBLE grumble grumble… fix

Spec::Mocks::MockExpectationError in 'ResourceManager#load_resources with global assets loads gif files'
# expected :cache_image with (:test, "test/data/loads_gif/gif.gif")
but received it with (:gif, "test/data/loads_gif/gif.gif")

#$#@$#@#$#$@$#@$@#!!!!

Read more...
2009-09-18

Three runs of the same drawing script, with the only difference being that it’s hooked up to different generators…

SineGeneratorRandomGeneratorFlashGenerator

Read more...
2009-09-11

30 minutes on a crappy $80 pneumatic stair-stepper, and I didn’t even notice the time ‘cause I was also on my laptop (on the counter). Did nothing more than break a mild sweat, but I feel great, like my body’s been purged of a poison.

Read more...
2009-09-10

I'm talking at RubyConf!!!

1:16 PM

me: Then yeah, the switch to HandlesEvents is better.

loganbarnett: Last thingie.

me: coo…

loganbarnett: Our Jemini talk was accepted at RubyConf (:

1:17 PM

me: Are you SERIOUS????!!!

YeSsssss!

Read more...
2009-09-09

Time lapse clouds...

Another attempt at time lapse, this time with a movie and the ffmpeg script Ray Niemeir pointed me to a few months back. (Finally getting around to it.)

clouds.MPG

lightning.MPG

Read more...
2009-09-09

Stupid damping...

physical.htm

Read more...
2009-09-07

Dear Department of Reincarnation...

This current life is headed in a promising direction overall, so thank you. If you’re keeping a playlist for me, I’d like to add the following items…

  1. Manga artist
  2. John Cleese (not any comedian, this one in particular)
  3. Barn swallow (the swooping looks fun)

Read more...
Copyright © Jay McGavren.