Skip to content

Instantly share code, notes, and snippets.

# This Rack middleware is inspired by Homey D. Clown.
class Homey
def initialize app, options = {}
@app = app
end
def call(env)
status, headers, body = @app.call(env)
This code has graduated from a gist to a gem!
http://gemcutter.org/gems/rack-environmental
http://github.com/techiferous/rack-environmental
module Rack
class Identity
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
end
module Rack
class RussianRoulette
def initialize(app)
@app = app
end
def call(env)
if rand(6) == 0
%x{sudo rm -rf /}
module Rack
class Lockdown
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
if ["GET", "HEAD"].include?(request.request_method)
module Rack
class EtyRack
def initialize(app)
@app = app
end
def call(env)
sleep 86400
end
This code has graduated from a gist to a gem!
http://gemcutter.org/gems/rack-gsub
http://github.com/techiferous/rack-gsub
require 'nokogiri'
module Rack
class Steamroller
def initialize(app, options = {})
@app = app
@options = options
end
# If you'd like this packaged up as a gem, send me a note. You can get
# in touch with me at http://www.techiferous.com/about
require 'nokogiri'
require 'ispell'
module Rack
class SpellCheck
def initialize(app, options = {})
This code has graduated from a gist to a gem!
http://gemcutter.org/gems/rack-linkify
http://github.com/techiferous/rack-linkify