Last active
March 1, 2025 04:41
-
-
Save cowboy/6966747ad374fb97b0ab to your computer and use it in GitHub Desktop.
A few JavaScript quines
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
// Today, I noticed that someone favorited this tweet of mine from 2012: | |
// https://twitter.com/cowboy/status/232587756486938624 | |
// !function $(){console.log('!'+$+'()')}() #quine | |
// So I fooled around for a little bit: | |
// Shortest JavaScript quine? | |
(function _(){return'('+_+')()'})() | |
// Have fun with this one! | |
(function $($_$,_,_$,_$_,$_){return[_=_[$_$](_$[$_++])][_[$_++]][_[$_++]]([][_[$_--]][_[$_++]](_$_,function($$){return _$[$$]||[$_,_$_,_,$_$,$][$_--]},$_++),_[++$_])})('split',',join,call,map',',()\'\\','1821383038303012434430383082',0) |
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
// Test a quine like so: | |
a= your_quine_code | |
a===eval(a) // must be true | |
// Eg. | |
a= (function _(){return'('+_+')()'})() | |
a===eval(a) // true |
It may not be the smallest quine, but it is certainly mine.
var joe = [
'dmFyIGpvZSA9IFs=',
'XTs=',
'Y29uc29sZS5sb2coYXRvYihqb2VbMF0pKTs=',
'Zm9yKHZhciBpID0gMDtpPGpvZS5sZW5ndGg7aSsrKXs=',
"Y29uc29sZS5sb2coYCcke2pvZVtpXX0nLGApOw==",
'fQ==',
'Y29uc29sZS5sb2coYXRvYihqb2VbMV0pKTs=',
'Zm9yKHZhciBpID0gMjtpPGpvZS5sZW5ndGg7aSsrKXs=',
'Y29uc29sZS5sb2coYXRvYihqb2VbaV0pKTs=',
'fQ==',
];
console.log(atob(joe[0]));
for(var i = 0;i<joe.length;i++){
console.log(`'${joe[i]}',`);
}
console.log(atob(joe[1]));
for(var i = 2;i<joe.length;i++){
console.log(atob(joe[i]));
}
also a real quine over here:
s=`l=console.log
q=String.fromCharCode(96)
l('s='+q+s+q)
l(s)`
l=console.log
q=String.fromCharCode(96)
l('s='+q+s+q)
l(s)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AI sure is making spam more insidious