-
-
Save chaserx/301527 to your computer and use it in GitHub Desktop.
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
$(function() { | |
// Github Repo JSON Endpoint | |
var endpoint = "http://github.com/api/v1/json/chaserx?callback=?"; | |
$.fn.sort = function() {return this.pushStack(jQuery.makeArray([].sort.apply(this, arguments)));}; | |
$.getJSON(endpoint, function(data) { | |
// Remove all the old projects! | |
$("#projects li").remove(); | |
// Sort the Repo JSON data by name. | |
data.user.repositories.sort(function(a, b) {return a.name > b.name;}); | |
// Build up the Repo HTML to insert into the page. | |
var reposHTML = ''; | |
$.each(data.user.repositories, function(i, repos) { | |
if (!repos.private) { | |
reposHTML += '<li><a href="'+repos.url+'">'+repos.name+'</a>'+'<p>'+repos.description+'</p>'+'</li>'; | |
} | |
}); | |
$("#projects").append(reposHTML); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment