Skip to content

Instantly share code, notes, and snippets.

@spier
Created February 29, 2012 22:30
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 spier/1944992 to your computer and use it in GitHub Desktop.
Save spier/1944992 to your computer and use it in GitHub Desktop.
See activity of the network of your repositories (activity as in the latest pushs)
#!/usr/bin/env ruby
require "rubygems"
require "open-uri"
require "pp"
require "logger"
require "json"
def get_repositories(user)
url = "http://github.com/api/v2/json/repos/show/#{user}"
repos = JSON[open(url).read]
repos = repos["repositories"]
end
def get_network(user,repo_name)
url = "http://github.com/api/v2/json/repos/show/#{user}/#{repo_name}/network"
network = JSON[open(url).read]
network = network["network"]
end
def get_network_changes(network)
network_changes = network.map{|n| "#{n["pushed_at"]} #{n["url"]}"}
network_changes.sort.reverse[0..5]
end
# -- MAIN
user = "maxogden"
repositories = get_repositories(user)
repositories.each do |r|
network = get_network(r["owner"],r["name"])
puts "#{r["owner"]}/#{r["name"]} :: network = #{network.size}"
network_changes = get_network_changes(network)
network_changes.each do |nc|
puts "\t#{nc}"
end
end
maxogden/99ATMs :: network = 4
2011/12/18 16:02:48 -0800 https://github.com/maxogden/99ATMs
2011/12/12 09:43:52 -0800 https://github.com/videmsky/open-atm.org
2011/12/03 16:30:38 -0800 https://github.com/h0ke/99ATMs
2011/12/03 14:26:44 -0800 https://github.com/ryanjarvinen/99ATMs
maxogden/action :: network = 5
2011/04/02 12:41:06 -0700 https://github.com/quirkey/action
2011/04/02 12:41:06 -0700 https://github.com/pjkelly/action
2010/12/22 12:59:35 -0800 https://github.com/maxogden/action
2010/09/26 08:51:11 -0700 https://github.com/rbriank/action
2010/09/26 08:51:11 -0700 https://github.com/FrancisVarga/action
maxogden/ADAPDX :: network = 2
2010/10/09 18:27:20 -0700 https://github.com/tjgillies/ADAPDX
2010/10/09 18:27:20 -0700 https://github.com/maxogden/ADAPDX
maxogden/apns-node :: network = 9
2011/10/20 07:18:32 -0700 https://github.com/mxml/apns-node
2011/05/29 22:44:49 -0700 https://github.com/samchandra/apns-node
2011/05/29 22:44:49 -0700 https://github.com/neojjang/apns-node
2011/05/29 22:44:49 -0700 https://github.com/maxogden/apns-node
2011/05/29 22:44:49 -0700 https://github.com/lyhiving/apns-node
2011/05/29 22:44:49 -0700 https://github.com/jpoz/apns-node
maxogden/autocomplete-search :: network = 1
2011/02/03 13:00:43 -0800 https://github.com/maxogden/autocomplete-search
maxogden/bl.ocks.org :: network = 9
2011/07/10 09:57:59 -0700 https://github.com/notmatt/bl.ocks.org
2011/07/10 09:57:59 -0700 https://github.com/netconstructor/bl.ocks.org
2011/07/10 09:57:59 -0700 https://github.com/mbostock/bl.ocks.org
2011/07/10 09:57:59 -0700 https://github.com/leoalassia/bl.ocks.org
2011/07/10 09:57:59 -0700 https://github.com/kleinjos/bl.ocks.org
2011/07/10 09:57:59 -0700 https://github.com/AndreaSotoa/bl.ocks.org
maxogden/blog :: network = 3
2011/12/02 13:20:46 -0800 https://github.com/maxogden/blog
2011/07/16 23:58:07 -0700 https://github.com/skunkwerks/blog
2010/12/01 13:36:37 -0800 https://github.com/der-harm/blog
maxogden/bodyparts :: network = 1
2010/06/22 11:05:31 -0700 https://github.com/maxogden/bodyparts
maxogden/bouncy :: network = 16
2012/02/12 19:10:11 -0800 https://github.com/substack/bouncy
2012/02/02 14:10:59 -0800 https://github.com/wearefractal/trouncy
2012/01/17 03:28:07 -0800 https://github.com/einaros/bouncy
2012/01/15 12:37:27 -0800 https://github.com/AgoristRadio/bouncy
2011/12/10 15:10:38 -0800 https://github.com/yorickvP/bouncy
2011/12/09 11:02:01 -0800 https://github.com/seebees/bouncy
maxogden/bubbrubb :: network = 3
2010/10/16 00:07:30 -0700 https://github.com/whoahbot/bubbrubb
2010/10/15 18:50:06 -0700 https://github.com/victusfate/bubbrubb
2010/10/15 18:50:06 -0700 https://github.com/maxogden/bubbrubb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment