Created
August 1, 2012 20:40
-
-
Save isaacsanders/3230541 to your computer and use it in GitHub Desktop.
Make a cool graph using Githubris and Graphene
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
source :rubygems | |
gem 'graphene' | |
gem 'githubris' | |
gem 'pry' | |
gem 'gruff' | |
gem 'rmagick' | |
# Also requires imagemagick, but the program will yell at you for that. |
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
require 'githubris' | |
require 'graphene' | |
require 'gruff' | |
require 'ostruct' | |
def gists | |
ghr.public_gists(count: 100) | |
end | |
def ghr | |
@ghr ||= Githubris.new | |
end | |
def files_for(gists) | |
gists.map(&:files).map(&:values).flatten.map{|f| OpenStruct.new(f) }.map do |f| | |
if f.language.nil? | |
f.language = "None" | |
end | |
f | |
end | |
end | |
Graphene.percentages(files_for(gists), :language).pie_chart('./pie_chart.jpg', 'Languages in the Last 100 Public Gists') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment