/*
    jquery.showGithub.js

    Author: Mike Haugland
    Date: Dec 4th, 2011
    Version: 1.0.1
*/

(function( $ ){
  $.fn.showGithub = function( options ) {
    var settings = $.extend( {
      'username'         : 'haugland'
    }, options);

    return this.each(function(){
      var endpoint = "http://github.com/api/v1/json/"+settings.username+"?callback=?";
      var node = $(this);
      $.getJSON(endpoint, function(data) {
        node.empty();
        $.each(data.user.repositories, function(i, repos) {
          if (!repos.private) {
            node.append('<li><a href="'+repos.url+'">'+repos.name+'</a><span class="github_description"> '+repos.description+'</span></li>');
          }
        })
      });
    });
  };
})( jQuery );

