Skip to content

Instantly share code, notes, and snippets.

@ZucchiniZe
Created December 7, 2014 01:12
Show Gist options
  • Select an option

  • Save ZucchiniZe/3e0a8acc43760acddcaa to your computer and use it in GitHub Desktop.

Select an option

Save ZucchiniZe/3e0a8acc43760acddcaa to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'json'
require 'rest_client'
get '/' do
api_result = RestClient.get 'https://api.github.com/users/zucchinize/repos', {:accept => "application/vnd.github.v3+json"}
json = JSON.parse(api_result)
erb :index, :locals => {json: json}
end
source 'http://rubygems.org'
gem 'rubygems-update'
gem 'bundler'
gem 'sinatra'
gem 'rest-open-uri'
gem 'json'
gem 'rest_client'
<table>
<th>Repos for ZucchiniZe</th>
<tr>
<th>
Repo Name
</th>
<th>
Stars
</th>
</tr>
<% for repo in json %>
<tr>
<td>
<a href="<%= repo['html_url'] %>"><%= repo['name'] %></a>
</td>
<td>
<%= repo['stargazers_count'] %>
</td>
</tr>
<% end %>
</table>
<hr noshade>
Powered by the <a href = 'https://developer.github.com/v3' target="_new">GitHub API</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment