Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
# USE_DM_0_9 = true
if defined?(USE_DM_0_9)
DM_GEMS_VERSION = "0.9.11"
DO_GEMS_VERSION = "0.9.12"
gem "data_objects", DO_GEMS_VERSION
gem "do_sqlite3", DO_GEMS_VERSION
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en_gb' xml:lang='en_gb' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>
Timeout test
</title>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
<script type='text/javascript'>
//<![CDATA[
function move_on() {
require 'rubygems'
gem 'jarib-celerity'
require 'celerity'
browser = Celerity::Browser.new
browser.goto("file://#{File.expand_path(File.dirname(__FILE__))}/timeout.html")
puts browser.url
!!! Strict
%html{ html_attrs("en_gb") }
%head
%title
Times Too
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "content-type" }/
%script{ :type => "text/javascript", :src => "http://localhost/~andy/javascripts/dojo/dojo.js.uncompressed.js", :djConfig => "parseOnLoad: true" }
:javascript
dojo.registerModulePath("dijit", "http://localhost/~andy/javascripts/dijit")
dojo.registerModulePath("dojox", "http://localhost/~andy/javascripts/dojox")
<?xml version='1.0' encoding='utf-8' ?>
<notice version='2.0.0'>
<api-key>bb2ccbb9fb37971f5b1d8f2810d81064</api-key>
<notifier>
<name>Merb::HoptoadNotifier</name>
<version>1.0.10</version>
<url>http://github.com/toolmantim/toadhopper</url>
</notifier>
<error>
<class>NoMethodError</class>
module Rack
class EnsureSsl
def initialize(app)
@app = app
end
def call(env)
ssl_request?(env) ? @app.call(env) : ssl_redirect(env)
end
@mrship
mrship / gist:974068
Created May 16, 2011 07:55
Log crash for Heroku w/ NewRelic
2011-05-16T07:52:42+00:00 app[web.1]: /app/vendor/plugins/rpm/lib/new_relic/control/frameworks/rails.rb:29:in `install_episodes': undefined method `episodes_enabled?' for Control[rails3]:NewRelic::Control::Frameworks::Rails3 (NoMethodError)
2011-05-16T07:52:42+00:00 app[web.1]: from /app/vendor/plugins/rpm/lib/new_relic/control/frameworks/rails.rb:24:in `init_config'
2011-05-16T07:52:42+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/newrelic_rpm-3.0.0/lib/new_relic/control/instance_methods.rb:60:in `init_plugin'
2011-05-16T07:52:42+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/newrelic_rpm-3.0.0/lib/newrelic_rpm.rb:36:in `block in <class:Railtie>'
2011-05-16T07:52:42+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
2011-05-16T07:52:42+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
2011-05-16T07:52:42+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9
@mrship
mrship / gist:1183134
Created August 31, 2011 09:11
XML error from JPEGMini
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>AC15B5DF72BA4CE6</RequestId>
<HostId>
POdz8uifrkuLWh7oA7cM+3GEURcPyItETksNEWt3aPVDcqF4CD4NcmsfPaToLeAg
</HostId>
</Error>
@mrship
mrship / rspec_test_within_a_block.rb
Created January 24, 2012 11:01
RSpec testing within a block
module PdfRenderer
describe Header do
let(:pdf) { mock(Prawn::Document) }
subject { Header.new(pdf) }
describe "#render" do
it "draws the header" do
pdf.should_receive(:repeat).with(:all) do
pdf.should_receive(:move_down) # this fails
end
@mrship
mrship / gist:2404790
Created April 17, 2012 09:13
SimpleForm hacks for Phrase
# original SimpleForm code (lib/simple_form/inputs/base.rb:142)
def translate(namespace, default='')
model_names = lookup_model_names.dup
lookups = []
while !model_names.empty?
joined_model_names = model_names.join(".")
model_names.shift