Created
June 8, 2015 04:39
-
-
Save NewAlexandria/d0ea7060d9ab8b7c7cd2 to your computer and use it in GitHub Desktop.
A list of the 10 most-recent submissions to papers we love
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.jQuery) { document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"><\/script>') }; | |
var recent_papers = []; | |
var commits = {}; | |
var base_commit = ''; | |
while (recent_papers.length < 10) { | |
commits_url = "https://api.github.com/repos/papers-we-love/papers-we-love/commits?sha="+base_commit; | |
$.ajax({ | |
url: commits_url, | |
success: function(data) { | |
$(data).each( function(idx) { | |
$.ajax({ | |
url: ("https://api.github.com/repos/papers-we-love/papers-we-love/commits/"+this.sha), | |
success: function(commit_data) { | |
$(commit_data.files).each(function() { | |
if (this.filename.match(/^.*\.pdf$/)) { | |
recent_papers.push(this.filename); | |
} | |
}); | |
} | |
}); | |
}); | |
base_commit = data[data.length-1].sha | |
} | |
}); | |
$.unique( recent_papers ); | |
} //while | |
console.log(recent_papers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment