Skip to content

Instantly share code, notes, and snippets.

View bmizerany's full-sized avatar
💭
Attempting the Kessel Run at Shopify

Blake Mizerany bmizerany

💭
Attempting the Kessel Run at Shopify
View GitHub Profile
# Require sinatra/base instead of sinatra to avoid some of the magic
require 'sinatra/base'
module Sample
class Main < Sinatra::Base
# Pretty normal application here
get '/' do
erb :index
end
end
git:master!sinatra/examples> thin start -R multiapp.ru -D
>> Thin web server (v1.0.1 codename ?)
>> Debugging ON
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
!! Unexpected error while processing request: block not supplied
block not supplied
./../lib/sinatra/base.rb:300:in `instance_eval'
./../lib/sinatra/base.rb:300:in `initialize'
./../lib/sinatra/base.rb:675:in `new'
def run(app, &blk)
insta = app.new(&blk) if blk && app.respond_to?(:new)
@ins << inst #lambda { |nothing| app }
end
require 'rubygems'
require 'sinatra'
require 'benchmark'
class SimpleBenchmark
def initialize(app)
@app = app
end
def call(env)
// ==UserScript==//
// @name Testing alert
// @namespace http://gist.github.com/491299
// @description You've been notified :)
// @include http://*.github.com
// ==/UserScript==
alert('testing');
<a href="javascript:alert(document.getSelection());">Selection</a>
>> Proc.new { |a| "test" }.call(1)
=> "test"
>> Proc.new { |a| "test" }.call(1,2)
(irb):2: warning: multiple values for a block parameter (2 for 1)
from (irb):2
=> "test"
>> Proc.new { |a| "test" }.call()
(irb):3: warning: multiple values for a block parameter (0 for 1)
from (irb):3
=> "test"
host "sinatrarb.com"
accept :xml
provides :xml
get '/' do
"Welcome!"
end
get '/' do
"You are not to be welcomed!"
end
@bmizerany
bmizerany / base.rb
Created January 30, 2009 02:11 — forked from rtomayko/base.rb
get / "/" /
Agent(/Firefox/) /
Accepts(:xml, :json) /
Provides(:json) do
@post.to_json
end
master!integrity> rake test --trace
(in /Users/blakemizerany/projects/integrity)
** Invoke test (first_time)
** Invoke test:units (first_time)
** Execute test:units
You're missing some gems required to run the tests.
Please run `rake test:install_dependencies`
You'll probably need to run that command as root or with sudo.
Thanks :)