Created
October 21, 2011 01:50
Revisions
-
udzura revised this gist
Oct 21, 2011 . 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 @@ -4,7 +4,7 @@ require 'rack/lobster' use Rack::CommonLogger use Rack::Lint use Rack::Auth::Basic do |user, passwd| user == "u-kondo" && passwd == "XXX" end run Rack::Lobster.new -
udzura created this gist
Oct 21, 2011 .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,10 @@ require 'rack' require 'rack/lobster' use Rack::CommonLogger use Rack::Lint use Rack::Auth::Basic do |user, passwd| user == "u-kondo" && passwd = "XXX" end run Rack::Lobster.new 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,24 @@ # coding: utf-8 require 'rack' require 'open-uri' class Harukazefier def initialize(app) @app = app end def call(env) orig_res = @app.call(env) res = Rack::Response.new orig_res[2], orig_res[0], orig_res[1] res.body = res.body.map{|txt| txt.gsub(/。/, "(ω)") } res["Content-Length"] = res.body.first.bytesize.to_s res.finish end end blog = "http://blog.udzura.jp/2011/10/04/sinatra-1-3-0-and-padrino-0-10-3-released-1/" use Rack::Lint use Harukazefier run lambda {|env| [200, {"Content-Type" => "text/html"}, [open(blog).read]] }