Skip to content

Instantly share code, notes, and snippets.

@tkfm-yamaguchi
Last active December 28, 2015 06:49
Show Gist options
  • Save tkfm-yamaguchi/7459910 to your computer and use it in GitHub Desktop.
Save tkfm-yamaguchi/7459910 to your computer and use it in GitHub Desktop.
get %r|^/github(/.+\.js)$| do
require 'net/https'
uri = params[:captures].first
js = ""
github = Net::HTTP.new("raw.github.com", 443)
github.use_ssl = true # do not forget this to access with HTTPS protocol
github.start do
## XXX: verify the http response status
js = github.get(uri).body
end
response["Content-Type"] = "application/javascript"
js
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment