This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rubygems" | |
| require "builder" | |
| class Roster | |
| def initialize | |
| @members = [] | |
| @members_cache = [] | |
| @content = nil | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo | |
| p self | |
| class << self | |
| def apples | |
| "foo" | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Fork this and add your example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A | |
| def self.extensions | |
| @extensions ||= [] | |
| end | |
| def self.run | |
| @extensions.each do |klass| | |
| klass.new.hello | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Prawn | |
| class Canvas | |
| include Prawn::Chunkable | |
| def initialize | |
| @chunks = [] | |
| end | |
| attr_accessor :chunks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def paint(canvas, filename) | |
| doc = Prawn::Document.new | |
| doc.add_content(canvas.to_pdf) | |
| doc.render_file(filename) | |
| end | |
| canvas = Prawn::Canvas.new | |
| canvas.line(:point1 => [100,100], :point2 => [150,175]) | |
| canvas.move_to(:point => [100,100]) | |
| canvas.curve_to(:point => [50,50], :bounds => [[60,90], [60,90]]) |