Skip to content

Instantly share code, notes, and snippets.

include Rails.application.routes.url_helpers
default_url_options[:host] = "localhost"
@bobanj
bobanj / time.rake
Created July 8, 2012 06:27 — forked from pjb3/time.rake
def format_time_interval(from_time, to_time)
seconds = (to_time - from_time).abs.round
minutes, seconds = seconds.divmod(60)
if minutes > 60 * 24
" "
elsif minutes > 60
hours, minutes =
" %2dh %2dm " % minutes.divmod(60)
else
" %2dm %2ds " % [minutes, seconds]
@bobanj
bobanj / capybara.md
Created July 6, 2012 23:14 — forked from steveclarke/capybara.md
RSpec Matchers

Capybara

Matchers

have_button(locator)

have_checked_field(locator)
require "matrix"
#First, you construct an adjacency matrix. An adjacency matrix is just a matrix of what is linking to what.
#[0, 1, 1, 1, 1, 0, 1]
#[1, 0, 0, 0, 0, 0, 0]
#[1, 1, 0, 0, 0, 0, 0]
#[0, 1, 1, 0, 1, 0, 0]
#[1, 0, 1, 1, 0, 1, 0]
#[1, 0, 0, 0, 1, 0, 0]