Skip to content

Instantly share code, notes, and snippets.

@boblail
boblail / test.rb
Created February 26, 2011 13:37
Test Google Analytics, new Image, and Zombie
require 'rubygems'
require 'sinatra'
get '/image' do
<<-HTML
<html>
<head>
<title>new Image Test</title>
</head>
<body>
@boblail
boblail / test.rb
Created February 26, 2011 03:37
Isolates Google Analytics for Zombie to test
require 'rubygems'
require 'sinatra'
get '/ga' do
<<-HTML
<html>
<head>
<title>Google Analytics Test</title>
</head>
<body>
@boblail
boblail / Capybara Zombie
Created January 20, 2011 02:08
Notes about capybara's examples which are failing for capyabara-zombie
1) Capybara::Driver::Zombie it should behave like driver with javascript support#drag_to should drag and drop an object
Failure/Error: @driver.find('//div[contains(., "Dropped!")]').should_not be_empty
expected empty? to return false, got true
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/handler.rb:44:in `handle_matcher'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/extensions/kernel.rb:50:in `should_not'
# /opt/local/lib/ruby/gems/1.8/gems/capybara-0.4.0/lib/capybara/spec/driver.rb:93
jQuery draggable.start and draggable.stop events are fired.
@boblail
boblail / Sample use of Pericope
Created October 11, 2010 20:10
Sample use of Pericope
@query = params[:query]
pretty_keywords = []
index_keywords = []
Pericope.split(@query, /[\r\n,;]/).each do |keyword|
if keyword.is_a?(Pericope)
pretty_keywords << keyword.to_s
index_keywords << "(#{keyword.to_a.join(" | ")})"
else
keyword = keyword.strip
class Dir
def Dir.glob_in(path, *args)
original_dir = Dir.pwd
begin
Dir.chdir(path)
return Dir.glob(*args)
ensure
Dir.chdir(original_dir)
end