Skip to content

Instantly share code, notes, and snippets.

@blowmage
blowmage / GEM_NAME.gemspec
Created June 8, 2011 22:08
Simple Gem Template
require "rake"
Gem::Specification.new do |s|
s.name = "GEM_NAME"
s.version = "0.1.0"
s.summary = "GEM_SUMMARY (short)"
s.description = "GEM_DESCRIPTION (longer)"
s.homepage = "http://example.com/GEM_NAME"
s.authors = ["GEM_AUTHOR_NAME"]
s.email = "GEM_AUTHOR_EMAIL"
@blowmage
blowmage / event_queue_callbacks.rb
Created April 5, 2011 19:26
Quick example on using a local hash to hold event callbacks.
class Foo
def start
# Do something important here
perform :start
end
def finish
perform :finish
# Clean up stuff here
end
@blowmage
blowmage / gist:590629
Created September 21, 2010 21:39
Array#=~
a = [1, 2, 3]
b = [3, 2, 1]
class Array
def =~(other)
self.sort == other.sort
end
end
puts a =~ b #=> true
require 'rubygems'
require 'gosu'
class LittleBrat < Gosu::Window
LETTER_LIMIT = 100
def initialize
# Full resolution, fullscreen
super(Gosu.screen_width, Gosu.screen_height, true)
self.caption = "Leave me alone you little brat!"
# The letters the little brat hits on the keyboard