Skip to content

Instantly share code, notes, and snippets.

@s2t2
Created April 12, 2015 03:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s2t2/770b79037870d5a1f008 to your computer and use it in GitHub Desktop.
Save s2t2/770b79037870d5a1f008 to your computer and use it in GitHub Desktop.
reads text from a public github repository
require 'github_api'
github = Github.new
dir = github.repos.contents.get :user => 's2t2', :repo => 'text', :path => '/'
files = dir.map{|f|
github.repos.contents.get :user => 's2t2', :repo => 'text', :path => f.path.to_s
}
file_contents = files.map{ |f|
Base64.decode64(f.content)
}
file_contents.each do |fc|
puts fc
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment