Skip to content

Instantly share code, notes, and snippets.

View mrmemes-eth's full-sized avatar
⚗️
creating

Stephen Caudill mrmemes-eth

⚗️
creating
View GitHub Profile
@mrmemes-eth
mrmemes-eth / .screenrc
Created October 16, 2008 01:22
My screenrc. liberally infuenced by _why's.
escape "^Ll"
setenv LC_CTYPE en_US.UTF-8
defutf8 on
autodetach on
crlf off
deflogin off
hardcopy_append on
startup_message off
@mrmemes-eth
mrmemes-eth / report_improved.rb
Created June 16, 2009 02:18
First pass at a more Ruby-like Report class from the example in Design Patterns in Ruby, Chapter 3 [for hashrocket bookclub]
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")
@mrmemes-eth
mrmemes-eth / spec_helper.rb
Created September 22, 2009 02:21
necessary configurations for using RSpec with Webrat for integration tests
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|
@mrmemes-eth
mrmemes-eth / gibbon.rb
Created October 10, 2009 17:35
Gibbon is a monkey patch to provide Given/When/Then templates for RSpec and Webrat integration tests
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)
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)
# 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' }
# 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)
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
@mrmemes-eth
mrmemes-eth / Gemfile
Created September 13, 2010 16:24
This terrible thing works
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'
@mrmemes-eth
mrmemes-eth / Gemfile
Created September 13, 2010 16:26
This terrible thing does not work
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'