Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Created April 6, 2011 20:09
Show Gist options
  • Save bmizerany/906417 to your computer and use it in GitHub Desktop.
Save bmizerany/906417 to your computer and use it in GitHub Desktop.
class BM
def initialize(app)
@app = app
end
def call(env)
start = Time.now
res = @app.call(env)
el = Time.now - start
p [:el, el]
res
end
end
require 'web'
require 'bm'
use BM
run Web
<table>
<% env.each do |k, v| %>
<tr><td><%= k %></td><td><%= v %></td></tr>
<% end %>
</table>
require 'rubygems'
require 'sinatra/base'
class Web < Sinatra::Base
use Rack::Auth::Basic do |user, pass|
["foo", "bar"] == [user, pass]
end
get '/' do
erb :index
end
get '/:key' do |key|
env[key] || "not found"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment