Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshtronic/427d0591379dc4255673 to your computer and use it in GitHub Desktop.
Save joshtronic/427d0591379dc4255673 to your computer and use it in GitHub Desktop.
self replicating node script
function replicate() {
tick = String.fromCharCode(39),
lines = [
'function replicate() {',
' tick = String.fromCharCode(39),',
'',
' lines = [',
' ];',
'',
' lines.forEach(function(line, index) {',
' console.log(line);',
'',
' if (index == 3) {',
' lines.forEach(function(line) {',
' console.log(" " + tick + line + tick + ",");',
' });',
' }',
' });',
'}',
'',
'replicate();',
];
lines.forEach(function(line, index) {
console.log(line);
if (index == 3) {
lines.forEach(function(line) {
console.log(" " + tick + line + tick + ",");
});
}
});
}
replicate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment