Skip to content

Instantly share code, notes, and snippets.

@raa0121
Created December 8, 2014 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raa0121/6bc578f497eefc3154e1 to your computer and use it in GitHub Desktop.
Save raa0121/6bc578f497eefc3154e1 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'json'
hoge = {}
urls = []
urls << JSON.parse(open("http://vim-jp.org/reading-vimrc/json/archives.json").read).map{|j|j["vimrc"].map{|v| v["raw_url"] }}
urls.flatten.uniq.map{|url|
begin
file = open(url).read.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "").split("\n")
file.select{|i|
j = i.sub(/git:\/\/github\.com(?:\/|:)/,"")
.sub(/https?:\/\/github\.com\//,"")
.sub(".git","").sub("git@github.com:","")
.sub("vim-scripts/","")
unless /^"[^"]*?$|^\s+?execute/ =~ j
if /(?:(?:Neo)?Bundle(?:Lazy|Fetch)?|Plug(?:in)?)\s+["']([^"']*)["']/ =~ j
unless $1 == ""
hoge[$1] ||= 0
hoge[$1] +=1
end
end
end
}
rescue OpenURI::HTTPError => ex
end
sleep 0.1
}
puts hoge.sort_by{|k,v| v}.reverse.map{|a|"#{a[1]} : #{a[0]}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment