Skip to content

Instantly share code, notes, and snippets.

Stephen Caudill voxdolo

View GitHub Profile
@voxdolo
voxdolo / .screenrc
Created Oct 16, 2008
My screenrc. liberally infuenced by _why's.
View .screenrc
escape "^Ll"
setenv LC_CTYPE en_US.UTF-8
defutf8 on
autodetach on
crlf off
deflogin off
hardcopy_append on
startup_message off
@voxdolo
voxdolo / report_improved.rb
Created Jun 16, 2009
First pass at a more Ruby-like Report class from the example in Design Patterns in Ruby, Chapter 3 [for hashrocket bookclub]
View report_improved.rb
class Report
attr_accessor :preamble, :before, :after, :prologue
def initialize
@subject = 'Monthly Report'
@content = ['Things are going', 'Really, really good!']
end
def generate
[:preamble,:head,:body,:prologue].map do |meth|
send(meth)
end.compact.join("\n")
@voxdolo
voxdolo / spec_helper.rb
Created Sep 22, 2009
necessary configurations for using RSpec with Webrat for integration tests
View spec_helper.rb
require 'webrat'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false # optional, but keeps me sane
end
Spec::Runner.configure do |config|
@voxdolo
voxdolo / gibbon.rb
Created Oct 10, 2009
Gibbon is a monkey patch to provide Given/When/Then templates for RSpec and Webrat integration tests
View gibbon.rb
module Spec::DSL::Main
alias :Feature :describe
def Story(description)
@description_args.push("\n#{description}\n")
end
end
module Spec::Example::ExampleGroupMethods
def executes(scope=:all, &blk)
before(scope, &blk)
View Interesting shows in SF during RubyConf
Röyksoppp, 11/19 - The Regency Ballroom (http://www.coasttocoasttickets.com/buy/san_francisco_ca.htm?pid=1176889)
Anti Pop Consortium, 11/20 - Mojito (http://www.sunsetpromotions.net/events/57845/Antipop-Consortium--Mojito)
DJ Nu Mark, 11/21 - The Mighty (http://www.sfstation.com/dj-nu-mark-e739571)
Cunning Lynguists and Pep Love, 11/21 - (http://www.ticketmaster.com/Cunninlynguists-Plus-Pep-Love-tickets/artist/1367539)
Dethklok and Mastodon, 11/21 - San Jose State University Event Center (http://www.livenation.com/edp/eventId/412063)
View gist:309711
# not so much like this:
class PeterParkerController < ApplicationController
def show
expose(:spider){ 'to radiation' }
end
end
# as like this:
class PeterParkerController < ApplicationController
expose(:spider){ 'to radiation' }
View have_option_matchers.rb
# usage:
# field_labeled('Select your address').should have_option("Home Address")
Spec::Matchers.define :have_option do |expected|
def options_for(select_field)
select_field.options.map(&:inner_text)
end
match do |select_field|
raise "Field is not a SelectField" unless select_field.kind_of?(Webrat::SelectField)
options_for(select_field).include?(expected)
View gist:407082
def wait_conditionally_until
if page.driver.wait?
page.wait_until do
begin
yield
rescue Selenium::WebDriver::Error::WebDriverError => e
# do nothing - continue to wait for timeout
end
end
else
@voxdolo
voxdolo / Gemfile
Created Sep 13, 2010
This terrible thing works
View Gemfile
source 'http://rubygems.org'
gem 'bundler', '~> 1.0.0'
gem 'decent_exposure', '~> 1.0.0.rc1'
gem 'devise', '~> 1.1.2'
gem 'haml'
gem 'hassle', :git => 'git://github.com/Papipo/hassle.git'
gem 'pg'
gem 'rails', '3.0.0'
@voxdolo
voxdolo / Gemfile
Created Sep 13, 2010
This terrible thing does not work
View Gemfile
require File.join(File.dirname(__FILE__),'dev_gemfile')
source 'http://rubygems.org'
gem 'bundler', '~> 1.0.0'
gem 'decent_exposure', '~> 1.0.0.rc1'
gem 'devise', '~> 1.1.2'
gem 'haml'
gem 'hassle', :git => 'git://github.com/Papipo/hassle.git'
gem 'pg'
You can’t perform that action at this time.