-
-
Save dratini0/2392358 to your computer and use it in GitHub Desktop.
Quine -- 140byt.es entry
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 f(){ //start named function expression | |
document.write('('+f+')()') //convert itself to a string, and wrap the result in (...)() (for calling) | |
})() //call it |
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 f(){document.write('('+f+')()')})() |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Bálint Kovács http://dratini0.co.cc/ | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. |
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
{ | |
"name": "quine", | |
"description": "A very simple javascript quine", | |
"keywords": [ | |
"quine", | |
"useless", | |
"simple", | |
"named function expression" | |
] | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Quine</title> | |
</head> | |
<body> | |
<div>Expected value: <b>function f(a){return (a?''+f:f)}</b></div> | |
<div>Actual value: </div> | |
<script> | |
// write a small example that shows off the API for your example | |
// and tests it in one fell swoop. | |
(function f(){document.write('('+f+')()')})() | |
</script> | |
</body> | |
</html> |
You are right. I will try without it. I did not know about that, it makes
much more sense. Thank you.
…On Apr 15, 2012 9:47 PM, "Mathieu 'p01' Henri" < ***@***.***> wrote:
Your quines are implicitly using the `toString` method, while it is a
feature of the language, it spoils the fun of writing quines. Check [1] and
[2] for ridiculously small JS quines that don't use the `toString` or
`toSource` methods.
[1]
http://web.archive.org/web/20100102034640/http://web-graphics.com/pages/quine.php
[2] http://sla.ckers.org/forum/read.php?24,33201
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2392358
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your quines are implicitly using the
toString
method, while it is a feature of the language, it spoils the fun of writing quines. Check [1] and [2] for ridiculously small JS quines that don't use thetoString
ortoSource
methods.[1] http://web.archive.org/web/20100102034640/http://web-graphics.com/pages/quine.php
[2] http://sla.ckers.org/forum/read.php?24,33201