如何在 github 组织中找到最大的加星项目
How to find the maximum starred project within an github organization
如何在包含许多跨越多个页面的项目(例如 https://github.com/foo)
的 github 组织中找到最大的加星项目(即最受欢迎)
GitHub 网站 UI 仅在 your Starred Projects page (see sortable stars)
上提供可排序的星星
剩下 GitHub API 是为了:
- list all the repos of an organization
- 按“
stargazers_count
”字段对 JSON 结果进行排序。
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
# スター数が多い順にソートして出力
# Sort order most Stars to output
result.sort_by{|k, v| -v}.each do |k, v|
printf "%4d: #{k}\n", v
end
如何在包含许多跨越多个页面的项目(例如 https://github.com/foo)
的 github 组织中找到最大的加星项目(即最受欢迎)GitHub 网站 UI 仅在 your Starred Projects page (see sortable stars)
上提供可排序的星星剩下 GitHub API 是为了:
- list all the repos of an organization
- 按“
stargazers_count
”字段对 JSON 结果进行排序。
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
# スター数が多い順にソートして出力
# Sort order most Stars to output
result.sort_by{|k, v| -v}.each do |k, v|
printf "%4d: #{k}\n", v
end