Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 8917828c21
Fetching contributors…

Cannot retrieve contributors at this time

executable file 32 lines (24 sloc) 0.598 kB
#!/usr/bin/env rackup -p 4567
# See README for usage
require 'sinatra/base'
Lookup = {
"gop" => "golang.org/pkg",
"ec2" => "docs.amazonwebservices.com/AWSEC2/latest/APIReference/"
}
Search = "http://www.google.com/search?sourceid=wack&ie=UTF-8&q=%s+site:%s"
class Wack < Sinatra::Base
error 404 do
redirect "/"
end
get "/" do
Lookup.map {|k,v| "<strong>%s</strong> - %s<br/>" % [k, v] }
end
get "/ack/:slug" do |slug|
redirect "/" if !Lookup.has_key?(slug)
redirect Search % [
params[:q],
Lookup[slug]
].map {|x| escape(x) }
end
end
run Wack
Jump to Line
Something went wrong with that request. Please try again.