Skip to content

Instantly share code, notes, and snippets.

@isaacsanders
Created August 1, 2012 20:40
Show Gist options
  • Save isaacsanders/3230541 to your computer and use it in GitHub Desktop.
Save isaacsanders/3230541 to your computer and use it in GitHub Desktop.
Make a cool graph using Githubris and Graphene
source :rubygems
gem 'graphene'
gem 'githubris'
gem 'pry'
gem 'gruff'
gem 'rmagick'
# Also requires imagemagick, but the program will yell at you for that.
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