Installation
gem install rmagick # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
| # RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
| # defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
| module Player | |
| describe MovieList, "with optional description" do | |
| it "is pending example, so that you can write ones quickly" | |
| it "is already working example that we want to suspend from failing temporarily" do | |
| pending("working on another feature that temporarily breaks this one") |
| class Dot | |
| class Node | |
| attr_reader :children, :name, :started | |
| attr_accessor :finished | |
| def initialize name, fields = [], started = Time.now | |
| @name = name | |
| @fields = fields | |
| @children = [] | |
| @started = started |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
| desc "A user's comment" do | |
| let(:user) { User.create! name: "John" } | |
| let(:comment) { user.comments.create! } | |
| it "delegates to user's name" do | |
| comment.name.should eq(user.name) | |
| end | |
| end |
| # Just wanted to clarify my points at the meetup last night. | |
| # | |
| # There were two different issues intertwined: | |
| # (1) Whether to use extend or "include as extend" | |
| # (2) When using "include as extend", what is the simplest way to achieve the goal? | |
| # | |
| # My personal opinion is that the answer to (1) is "extend", not "include as extend", but that | |
| # is just my personal opinion. My answer to (2) is a more empirical question. | |
| # Using the "extend" approach. Again, I personally prefer the simplicity of this approach, but |
| #!/usr/bin/ruby1.9 | |
| require 'fiber' | |
| require 'benchmark' | |
| class Ring | |
| attr_reader :id | |
| attr_accessor :attach | |
| def initialize(id) |
| require "thread" | |
| class Future | |
| attr_reader :exception, :cancelled | |
| def initialize(&block) | |
| @thread = Thread.new(&block) | |
| @thread.abort_on_exception = false | |
| @exception = nil | |
| @cancelled = false |
| ## | |
| # Make Rack look like node. | |
| # | |
| # http://youtu.be/Zp91yUH-zAw | |
| require 'node_adapter' | |
| use Rack::Chunked | |
| run createServer { |req, res| |
| # For context, this was inspired by the RubyRogues podcast #79 where they talked about | |
| # documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc. | |
| # | |
| # http://rubyrogues.com/079-rr-documenting-code/ | |
| # | |
| # As someone who's spent a lot of time using an IDE for programming C# and Java, I think | |
| # Ruby could do a lot better at putting documentation at our fingertips as we program. | |
| # | |
| # Maybe making the documentation part of the structure of the code would facilitate this? | |
| # |