// yay https://developer.github.com/v3/#cross-origin-resource-sharing

function foo(response) {                                                        
    var meta = response.meta;                                                   
    var data = response.data;                                                   
    console.log(meta);                                                          
    console.log(data);   
    data.forEach(checkForLicense);
}                                                                               
function checkForLicense(){
    console.log(this);
    name = this.name;
    console.log(name);
    url = this.html_url;
    console.log(url);

}

var script = document.createElement('script');                                  
script.src = 'https://api.github.com/users/edunham/repos?callback=foo';                             
                                                                                
document.getElementsByTagName('head')[0].appendChild(script);  

// yay https://developer.github.com/v3/#cross-origin-resource-sharing

function handleRepoList() {
    var data = JSON.parse(this.responseText);
    console.log(data);
    data.forEach(learnAboutRepo);
}
function learnAboutRepo(repoObj){
    var name = repoObj.name;
    console.log(name);
    var url = repoObj.url;
    console.log(url);
    var repoReq = new XMLHttpRequest();
    repoReq.onload = digInFiles;
    repoReq.open("get", url, true);
    repoReq.send();
}

function digInFiles(){
    var repo = JSON.parse(this.responseText)
    console.log(repo);
}

console.log("don't worry, it's working");
var oReq = new XMLHttpRequest();
oReq.onload = handleRepoList;
oReq.open("get", "https://api.github.com/users/marajade/repos", true);
oReq.send();


switch to mara to hit rate limit slower