Skip to content

Instantly share code, notes, and snippets.

@NewAlexandria
Created June 8, 2015 04:39
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 NewAlexandria/d0ea7060d9ab8b7c7cd2 to your computer and use it in GitHub Desktop.
Save NewAlexandria/d0ea7060d9ab8b7c7cd2 to your computer and use it in GitHub Desktop.
A list of the 10 most-recent submissions to papers we love
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