Last active
December 21, 2017 13:50
-
-
Save faymek/6b1812d551f394b6b58e30b076bb4e08 to your computer and use it in GitHub Desktop.
This file contains 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
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem "octokit" | |
This file contains 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
GEM | |
remote: https://rubygems.org/ | |
specs: | |
addressable (2.5.2) | |
public_suffix (>= 2.0.2, < 4.0) | |
faraday (0.13.1) | |
multipart-post (>= 1.2, < 3) | |
multipart-post (2.0.0) | |
mustermann (1.0.1) | |
octokit (4.8.0) | |
sawyer (~> 0.8.0, >= 0.5.3) | |
public_suffix (3.0.1) | |
rack (2.0.3) | |
rack-protection (2.0.0) | |
rack | |
sawyer (0.8.1) | |
addressable (>= 2.3.5, < 2.6) | |
faraday (~> 0.8, < 1.0) | |
sinatra (2.0.0) | |
mustermann (~> 1.0) | |
rack (~> 2.0) | |
rack-protection (= 2.0.0) | |
tilt (~> 2.0) | |
tilt (2.0.8) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
octokit | |
sinatra | |
BUNDLED WITH | |
1.16.0 |
This file contains 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
require "sinatra" | |
require "octokit" | |
set :views, "." | |
helpers do | |
def h(text) | |
Rack::Utils.escape_html(text) | |
end | |
end | |
get '/:username' do |username| | |
#user = Octokit.user username | |
gists = Octokit.gists username, :per_page => 5 | |
erb :index, locals:{ :gists => gists, username: username} | |
#count = user.public_gists | |
#erb :index, locals: { :count => count } | |
end |
This file contains 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
<html> | |
<body> | |
<h2>User <%= username %>'s last five gists</h2> | |
<% gists.each do |g| %> | |
<% g[:files].fields.each do |f| %> | |
<b><%= f %></b>: | |
<%= h g[:files][f.to_sym].rels[:raw].get.data %> | |
</br> | |
</br> | |
<% end %> | |
<% end %> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment