-
-
Save ntulip/702047 to your computer and use it in GitHub Desktop.
Revisions
-
igrigorik revised this gist
Nov 16, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class Object def webapp class << self define_method :call do |env| func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) [200, {}, send(func, *attrs)] end end -
igrigorik revised this gist
Nov 15, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class << self # http://localhost:9292/push/1 -> 1 # http://localhost:9292/push/2 -> 12 # http://localhost:9292/push/3 -> 123 # http://localhost:9292/to_a -> 123 -
igrigorik created this gist
Nov 13, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ require 'rubygems' require 'rack' class Object def webapp class << self define_method :call do |env| func, *attrs = env['REQUEST_PATH'].split('/').reject(&:empty?) [200, {}, send(func, *attrs)] end end self end end Rack::Handler::Mongrel.run [].webapp, :Port => 9292 # ^^^^^^^^^^^ # | (x) # ROFLSCALE DB ---/ # # http://localhost:9292/push/1 -> 1 # http://localhost:9292/push/2 -> 12 # http://localhost:9292/push/2 -> 123 # http://localhost:9292/to_a -> 123 # http://localhost:9292/pop -> 3 # http://localhost:9292/shift -> 1