Created
June 30, 2014 03:50
-
-
Save anonymous/217cd6addcd412f5419e to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> </body> </html> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ $(document).ready(function(){ $.ajax({ type: "get", url: "https://api.github.com/users/achalv/repos?type=public&sort=updated&direction=desc", dataType: "json", success: function(returnedData){ console.log(returnedData); var contribs = []; returnedData.forEach(function(obj) { //console.log(obj.fork); var isFork = obj.fork; var createdAt = obj.created_at; var lastPushedAt = obj.pushed_at; if((isFork)&&lastPushedAt>createdAt){ contribs.push(obj); } //contribs.forEach(function(result)) }); //console.log(contribs); function sortByKey(array, key) { return array.sort(function(a, b) { var x = a[key]; var y = b[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); } var sContribs = sortByKey(contribs, 'size'); console.log(sContribs); for(var i=0; i<sContribs.length;i++){ var subObj = sContribs[i]; console.log(subObj.name); } } }); });