Last active
August 29, 2015 13:56
-
-
Save oupo/9325027 to your computer and use it in GitHub Desktop.
gist検索
This file contains 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
// あらかじめ<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