Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created February 10, 2009 21:18
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 mbleigh/61597 to your computer and use it in GitHub Desktop.
Save mbleigh/61597 to your computer and use it in GitHub Desktop.
jQuery.githubUser = function(username, callback) {
jQuery.getJSON("http://github.com/api/v1/json/" + username + "?callback=?", callback);
}
$.githubUser('mbleigh', function(data) {
$('#github-projects').html('');
var repos = data.user.repositories;
repos.sort(function(a,b) {
return b.watchers - a.watchers;
});
$(repos).each(function() {
$('#github-projects').append("\
<div class='repo'>\
<h3><a href='" + this.url + "'>" + this.name + "</a></h3>\
<span class='desc'>"+this.description+"</span>\
</div>");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment