Skip to content

Instantly share code, notes, and snippets.

@bahamas10
Created March 4, 2015 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bahamas10/c7a7f30eb6721ce308c1 to your computer and use it in GitHub Desktop.
Save bahamas10/c7a7f30eb6721ce308c1 to your computer and use it in GitHub Desktop.
node quine
#!/usr/bin/env node
var util = require("util");
var source = [
'#!/usr/bin/env node',
'',
'var util = require("util");',
'',
'var source = [',
'];',
'',
'var q = String.fromCharCode(39);',
'source.map(function(l, i) {',
' console.log(l);',
' if (i === 4)',
' source.forEach(function(_l) {',
' console.log("%s%s%s,", q, _l, q);',
' });',
'});',
];
var q = String.fromCharCode(39);
source.map(function(l, i) {
console.log(l);
if (i === 4)
source.forEach(function(_l) {
console.log("%s%s%s,", q, _l, q);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment