Created
April 6, 2011 20:09
-
-
Save bmizerany/906417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'web' | |
require 'bm' | |
use BM | |
run Web |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<% env.each do |k, v| %> | |
<tr><td><%= k %></td><td><%= v %></td></tr> | |
<% end %> | |
</table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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