This file contains 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 "minitest/autorun" | |
# Each member of a Cartesian Array corresponds to the selection of one element each in every one of those sets. | |
# http://en.wikipedia.org/wiki/Cartesian_product | |
class CartesianArray < Array | |
# CartesianArray.new([0,1], [a,b], etc) | |
def initialize(*args) | |
super args |
This file contains 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
# config/initializers/sequel.rb | |
module Kaminari | |
module Sequel | |
def self.included(base) | |
base.class_eval do | |
alias :num_pages :page_count | |
alias :limit_value :page_size |
This file contains 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
#! /usr/bin/env ruby | |
# encoding: UTF-8 | |
require 'date' | |
since = ARGV.shift || Date.today | |
logs = `git log --since="#{since}" --pretty=format:"%H,%ae,%ai"` | |
all_commits = logs.split("\n").map{|i| i.split(",") } |
This file contains 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 'rqrcode' | |
require 'erb' | |
text = ARGV.shift | |
if text.nil? | |
puts "Please supply some text.." | |
exit | |
end |
This file contains 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
Grilling & Fire | |
grill rack | |
long tongs / poker stick | |
hatchet / ax | |
saw | |
wood / kindling | |
newspaper | |
hot pads or heat gloves | |
lighter & matches |
This file contains 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
# config/application.rb | |
module YourApp | |
class Application < Rails::Application | |
require 'spree_site' | |
# ... | |
end |
This file contains 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 DateTimeHelper | |
def time_to_next_quarter_hour(time) | |
array = time.to_a | |
quarter = ((array[1] % 60) / 15.0).ceil | |
array[1] = (quarter * 15) % 60 | |
Time.local(*array) + (quarter == 4 ? 3600 : 0) | |
end | |
end |
This file contains 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
source 'http://rubygems.org' | |
gem 'cucumber', '>= 1.0.2' | |
gem 'rspec', '>= 2.6.0' | |
gem 'webrat', '>= 0.7.3' | |
gem 'mechanize', '>= 2.0.1' |
This file contains 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
34) Error: | |
test: Post should validate date time. (PostTest): | |
ArgumentError: Not registered: block_given? | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/registry.rb:18:in `find' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl.rb:51:in `sequence_by_name' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/syntax/methods.rb:118:in `generate' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/attribute/sequence.rb:11:in `add_to' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/attribute/implicit.rb:10:in `add_to' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/factory.rb:81:in `block in run' | |
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc3/lib/factory_girl/factory.rb:79:in `each' |
This file contains 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
# config/initializers/config.rb | |
CONFIG = YAML.load(File.read(Rails.root.join("config/config.yml")))[Rails.env].symbolize_keys |