Created
June 2, 2009 00:41
-
-
Save heisters/121908 to your computer and use it in GitHub Desktop.
a rake task to pull gists from github.com as html
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 characters
# A rake task to pull all your gists from github.com as html. | |
# | |
# This has advantages over the script embed: | |
# * the script uses document.write, which is not compatible with XHTML Strict 1.0 | |
# * document.write also can't be used after the document body has loaded (ie. no AJAX) | |
# * the gists get indexed by search engines this way | |
desc "Pull all gists from github and cache them locally" | |
task :gists do | |
uri = URI.parse 'http://gist.github.com/api/v1/yaml/gists/heisters' | |
html = YAML.load(Net::HTTP.get(uri))['gists'].inject('') do |h, gist| | |
h << Net::HTTP.get(URI.parse("http://gist.github.com/#{gist[:repo]}.pibb")) | |
end | |
File.open(File.dirname(__FILE__)+'/gists.html', 'w'){|f|f.write html} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment