Skip to content

Instantly share code, notes, and snippets.

@sunblaze
sunblaze / rspec-syntax-cheat-sheet.rb
Created May 30, 2012 18:50 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# 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")
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/iTerm2-1_0_0_20120726.zip'
md5 '596c8ff70a836f67ee3197bb60cf92b3'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install
@sunblaze
sunblaze / cached.rb
Last active December 12, 2015 09:09 — forked from practicingruby/cached.rb
module Cached
def cache(*method_names)
method_names.each do |m|
original = instance_method(m)
results = {}
define_method(m) do |*a|
results[a] ||= original.bind(self).call(*a)
end
end