github 2

made my own showtree() to recurse through github directory structure

by Andy Bulka

HTML

<script src="https://dl.dropboxusercontent.com/u/2019810/scripts/github.bundle.min.js"></script>

JavaScript

console.log('GITHUB analysis....')
var github = new Github();
var repo = github.getRepo('abulka', 'pynsource');

String.prototype.repeat = function( num ) {
    return new Array( num + 1 ).join( this );
}

function showtree(dir_str, indent) {
  //console.log('showtree:', dir_str);
	repo.contents('master', dir_str, function(err, contents) 
	{
    for (var x=0; x < contents.length; x++){
      var f = contents[x];

      if (f.type == 'dir') {
        showtree(f.path, indent+1);
      }
      if (f.path.indexOf(".py") > -1) 
      {
        var s = "    ".repeat(indent);
        console.log(s, f.path);  // or f.html_url
      }
    }
  });
}
showtree('src', 0);