Skip to content

Instantly share code, notes, and snippets.

class Poller < Rails::Metal
def process(env)
if env["PATH_INFO"] =~ /^\/poller_rack/
return [200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
end
end
end
# Implementation:
#!/bin/sh
# git-create-remote-branch <branch_name>
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
set branch_name = $1
git push origin origin:refs/heads/${branch_name}
def root(*args)
if defined?(RAILS_ROOT)
args.compact.empty? ? RAILS_ROOT : File.join(RAILS_ROOT, args)
end
end
config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host