Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile
module Prawn
module Chunkable
def chunk(*a, &b)
Prawn::Core::Chunk.new(*a, &b)
end
def find_chunks(params)
if params[:command]
chunks.select { |c| c.command == params[:command] }
end
class Demo < Prawn::Document
def flower
0.step(270, 90) do |angle|
rotate(angle, :origin => [100, 100]) do
fill_color(random_color)
polygon [100, 100], [150, 150], [200, 100]
fill_and_stroke
end
end
end
Jul 07, 14:01:23
seacreature
I will be starting in 2 minutes, but please say hi now and mention your city :)
Jul 07, 14:01:24
locks
or we'd have the sessions up and running
Jul 07, 14:01:29
chrisdinn
JOINED
class A
def self.extensions
@extensions ||= []
end
def self.run
@extensions.each do |klass|
klass.new.hello
end
end
Benchmark
CSV (Ruby 1.9, not 1.8!)
DRb
Delegator ## aguids
FileUtils ## tehviking
Fiber ## afcapel
JSON (The Ruby 1.9 stdlib, NOT the gems) ## sweetmango
Matrix ## morgy
MiniTest
OptionParser ## jazzu
Fork this and add your example
class Foo
p self
class << self
def apples
"foo"
end
end
end
require "rubygems"
require "builder"
class Roster
def initialize
@members = []
@members_cache = []
@content = nil
end
## Extract Class (http://refactoring.com/catalog/extractClass.html)
class Person
attr_accessor :name, :office_area_code, :office_number
def telephone_number
[office_area_code, office_number].join('-')
end
end
class Contact
def initialize(&block)
instance_eval &block
end
def name(new_name=nil)
@name = new_name if new_name
@name
end