View gist:2263414
This file contains 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 characters
// index.js | |
require("./m.js").init(); | |
console.log(global.hi); | |
// m.js | |
exports.init=function(){ | |
global.hi="hi"; | |
}; | |
/* |
View config.js
This file contains 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 characters
exports.Config={ | |
backend:{ | |
host:"nodejs", | |
port:80 | |
}, | |
files:{ | |
chunkSize:1024*100, // size of chunks that a file is requested from server, saved, removed etc (bytes) | |
timeout404:60, // remove file from 404 list if it was not found after given amount of seconds (seconds) | |
//recheckBackendStatus:3600, // check if file's status and size changed on backend (seconds) | |
maxStorageSize:20*1024*1024, // maximum storage used for cached files (bytes) |
View iteration.js
This file contains 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 characters
function a(i){ | |
var aLotOfVariable; | |
iDo.some.asyncStuff(function(){ | |
// here the callstack can grow huge a(0)->a(1)->a(2)->a(3) | |
// question is how to avoid this. | |
if(i<1000) a(i+1); | |
}); | |
} |
View foo.js
This file contains 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 characters
function stuff(){ | |
console.log("hi"); | |
} | |