Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile
class MyCollection
def initialize
@data = []
@data.extend(MySpecialFeatures)
end
def some_method
@data.use_one_of_my_features
end
end
#include<stdio.h>
#if !defined(__LP64__)
#define IS_64 0
#else
#define IS_64 1
#endif
main()
{
@practicingruby
practicingruby / test_helper.rb
Created July 5, 2011 13:40
Collection of test helpers for MiniTest
require "minitest/autorun"
require "set"
FIXTURE_DIR = File.expand_path(
File.dirname(__FILE__)+"/fixtures/")
# adopted from: https://gist.github.com/839034
def context(*args, &block)
return super unless (name = args.first) && block
seacreature:spork-testing$ spork
NOTE: Gem.latest_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.latest_load_paths called from /Users/seacreature/.rvm/gems/ruby-1.9.2-p180/gems/spork-0.8.5/lib/spork.rb:112.
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_partials called from /Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:600.
undefined method `specifications' for "/Users/seacreature/.rvm/gems/ruby-1.9.2-p180":String (NoMethodError)
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:425:in `block in each_load_path'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:423:in `each'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:423:in `each_load_path'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:587:in `block in latest_load_paths'
$ ack Gem
features/steps/rails_steps.rb
13: FileUtils.ln_sf(ENV["BUNDLE_GEMFILE"], "Gemfile")
14: FileUtils.ln_sf(ENV["BUNDLE_GEMFILE"] + ".lock", "Gemfile.lock")
features/support/bundler_helpers.rb
6: command = "env RUBYOPT= BUNDLE_GEMFILE=Gemfile bundle install"
13: gemfile_lock = dir + "/Gemfile.lock"
14: gemfile = dir + "/Gemfile"
18: puts "Gemfile #{gemfile} has changed since it was locked. Re-locking..."
$ spork --bootstrap
NOTE: Gem.latest_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.latest_load_paths called from /Users/seacreature/.rvm/gems/ruby-1.9.2-p180/gems/spork-0.8.5/lib/spork.rb:112.
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_partials called from /Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:600.
undefined method `specifications' for "/Users/seacreature/.rvm/gems/ruby-1.9.2-p180":String (NoMethodError)
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:425:in `block in each_load_path'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:423:in `each'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:423:in `each_load_path'
/Users/seacreature/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:587:in `block in latest_load_paths'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require "minitest/autorun"
# inspired by some code from Chris Wanstrath (shared w. me by Ryan Smith)
# https://gist.github.com/25455
#
# heavily modified by Gregory Brown at this point..
def context(*args, &block)
return super unless (name = args.first) && block
require "minitest/autorun"
require_relative "../lib/ivory_tower"
require_relative "shared/allowed_units"
# adopted from: https://gist.github.com/839034
def context(*args, &block)
return super unless (name = args.first) && block
context_class = Class.new(MiniTest::Unit::TestCase) do
class << self
module PlayingCards
class Card
attr_accessor :rank, :suit
def initialize(a_rank, a_suit)
@rank = parse_rank a_rank
@suit = parse_suit a_suit
end