Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created May 1, 2015 20:18
Show Gist options
  • Save kwhinnery/bd7c0353b07aa715235d to your computer and use it in GitHub Desktop.
Save kwhinnery/bd7c0353b07aa715235d to your computer and use it in GitHub Desktop.
var fs = require('fs');
fs.readdir('./challenges/',function(err,files){
if(err) throw err;
for(i=0;i<files.length;i++) {(
function(index) {
fs.readFile('./challenges/' + files[index], "utf-8", function (err, data) {
if (err) throw err;
challenges.push({ 'id':j, 'markup': marked(data) });
});
})(i);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment