Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# /etc/init.d/xvfb_daemon
# Xvfb startup script.
# Tom Meier <tom@venombytes.com>
#
### BEGIN INIT INFO
# Provides: xvfb
# Short-Description: Start/stop/restart daemon
# Description: Controls the Xvfb daemon which starts/stops the X Virtual Framebuffer server
### END INIT INFO
@ldenman
ldenman / wait_until.rb
Created March 8, 2012 20:59 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
@ldenman
ldenman / ar_patch.rb
Created May 13, 2011 20:29 — forked from amw/ar_patch.rb
A patch that allows lambda arguments to default_scope in rails ~> 3.0.0
module ActiveRecord
class Base
class << self
def default_scope(options = {})
reset_scoped_methods
default_scoping = self.default_scoping.dup
previous = default_scoping.pop
if previous.respond_to?(:call) or options.respond_to?(:call)
def pending_total
if not_needed?
0.00
else
# everyone gets the member pricing
daily_rate = ACCOMMODATION_RATES[room_type][:member]
departure_date = departure.to_date
arrival_date = arrival.to_date
total_days = departure_date - arrival_date
before_discounted_days = [[start_date - arrival_date, 3].min, 0].max
@ldenman
ldenman / gist:292955
Created February 2, 2010 19:50 — forked from anonymous/gist:292948
test
# for testing validates_length_of :name, :within => 3..100, :allow_nil => true
it "should not be valid with a name having less than 3 or more than 100 characters, if name is given" do
@category = Category.new @valid_attributes
@category.name = 'to'
@category.should have(1).errors_on(:name)
@category.errors.on(:name).should include "too short"
@category = Category.new @valid_attributes
@category.name = 't'*101
@category.should have(1).errors_on(:name)
@category.errors.on(:name).should include "too long"