Skip to content

Instantly share code, notes, and snippets.

@moreta
Forked from pi-chan/sort_repos.rb
Last active August 29, 2015 14:00
Show Gist options
  • Save moreta/11214932 to your computer and use it in GitHub Desktop.
Save moreta/11214932 to your computer and use it in GitHub Desktop.
require "github_api"
# スター数を知りたいリポジトリ user/name
repos = %W{
allaboutapps/A3GridTableView
AlanQuatermain/AQGridView
norsez/BDDynamicGridViewController
hirohisa/BrickView
phranck/CNGridView
gmoledina/GMGridView
youknowone/GridTableView
ixnixnixn/IAInfiniteGridView
JackTeam/InstagramThumbnail
joecarney/JCGridMenu
kristopherjohnson/KJGridLayout
kolinkrewinkel/KKGridView
sobri909/MGBox2
sobri909/MGBoxKit
mwaterfall/MWPhotoBrowser
NOUSguide/NGVaryingGridView
njdehoog/NHBalancedFlowLayout.git
rhodgkins/RDHCollectionViewGridLayout
rnystrom/RNGridMenu
brewster/SMGridView
troyharris/THGridMenu
}
result = {}
repos.each do |r|
user, repo = r.split "/"
info = nil
# たまに404があったりするので適当にrescue
begin
info = Github.repos.find user, repo
rescue
next
end
count = info["stargazers_count"]
result["#{r}"] = count
end
# スター数が多い順にソートして出力
result.sort_by{|k, v| -v}.each do |k, v|
printf "%4d: #{k}\n", v
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment