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 TabularSupport | |
def hashes_from_table | |
actual = find("table") | |
headers = actual.all("th").map(&:text) | |
actual.all("tbody tr").map do |row| | |
Hash[headers.zip row.all("td").map(&:text).compact.map(&:strip)] | |
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
# tasks for working with your heroku database | |
# | |
# Examples: | |
# | |
# Replace development DB with a fresh capture from Heroku | |
# (removing the oldest one first) | |
# | |
# rake hdb:clone # replace development database with a fresh capture of the | |
# heroku database | |
# |
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
ApplicationController.class_eval do | |
rescue_from StandardError do |exception| | |
$stderr.puts ExceptionFormatter.summarize exception | |
raise | |
end | |
end | |
class ExceptionFormatter | |
extend Cucumber::Term::ANSIColor | |
def self.summarize(e) |
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
#!/usr/bin/env bash | |
source ~/.rvm/scripts/rvm | |
rvm install 1.9.3 | |
rvm use --default 1.9.3 | |
cd $HOME | |
echo 'colorscheme railscasts' >> $HOME/.vimrc.local |
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 AutoloadBug | |
AutoLoadedConstant = 5 | |
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
require 'method_source' | |
module ChristmasTree | |
class WrappingPaper | |
class ExpressionParser | |
attr_reader :block | |
ExpressionOptions = Struct.new(:expression, :line_number) do | |
def range |
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
# $ rails new <rails_app_name> -m base_app.rb -S -T -d postgresql | |
# Install gems | |
gem "haml-rails" | |
gem "decent_exposure" | |
gem_group :development do | |
gem "better_errors" | |
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
// Generated by CoffeeScript 1.6.3 | |
var constraint, material, mesh, wheel_geometry; | |
material = Physijs.createMaterial(new THREE.MeshLambertMaterial({ | |
map: THREE.ImageUtils.loadTexture('images/checker.gif') | |
}), .8, .5); | |
wheel_geometry = new THREE.CylinderGeometry(5, 5, 2, 16); | |
mesh = new Physijs.CylinderMesh(wheel_geometry, material, 16); |
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
# credit @rwz | |
When /^I follow "([^"]+"(?: then "[^"]+")*)$/ do |links| | |
links.chomp(?").split('" then "').each do |link_text| | |
click_link link_text | |
end | |
end | |
# Example usage: | |
# When I follow "thing1" then "thing2" then "thing3" |
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 PathFinder | |
attr_reader :paths | |
def initialize(paths) | |
@paths = paths | |
end | |
def find(request_path) | |
find_path(request_path) or fail ActiveRecord::RecordNotFound | |
end |