Skip to content

Instantly share code, notes, and snippets.

@oupo
Last active August 29, 2015 13:56
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 oupo/9325027 to your computer and use it in GitHub Desktop.
Save oupo/9325027 to your computer and use it in GitHub Desktop.
gist検索
// あらかじめ<data:text/html,>なんかを開いておいてFirebug上で実行する
include("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"); // この行だけ単独で先に実行すること
let N = 5;
let USER = "mattn";
function pred(x) Object.keys(x.files).some(function (n) /\.go/.test(n));
function loop(n) {
if (n > N) return;
let url = "https://api.github.com/users/"+USER+"/gists?page="+n;
return $.getJSON(url).then(function(a) {
a.filter(pred).forEach(function(x) {
$(document.body).append($("<a/>").text(Object.keys(x.files)).attr("href", x.html_url)).append("<br/>");
});
return loop(n+1);
})
}
$(document.body).empty();
loop(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment