Skip to content

Instantly share code, notes, and snippets.

@sugyan
Created May 19, 2011 04:31
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 sugyan/980193 to your computer and use it in GitHub Desktop.
Save sugyan/980193 to your computer and use it in GitHub Desktop.
javascript version of "Quine ruBy" (http://d.hatena.ne.jp/ku-ma-me/20110405/p1)
eval ($a=
'a=1;p= this[1\
&&"alert" ]?(a=0+0\
) ||alert:1 &&this["p"+ "rint"]?( \
1 &&print):console.log,u=unescape,q=u(( \
0 ||"%27")),f=Function,x=f("t,n","v \
= [];while(n--)v+=t;return"+(s=u("%20") \
)+"v"),n=u("%0a"),r=[45,95,145,194,243,1\
+290,339,387,436,486,537,589,642,695,749\
,53 +750,858,913,969];for(i=19;i--;)$a= $a\
[(e ="replace")](RegExp(".{"+r[i]+"}"),"" +(\
"$&" )+(b= u("%5c"))+n);if(a ){c=[ 5,(\
45), 5,55, 2, 31,58,43,2,31,( 58 ),53, 1,(\
30),( 86),( 58),43,1,30,86, 58,53 ,5,(\
45),5 ,28],o =521;for(i=26;i-- ;){$a= $a[e\
](($a) .substr(0,o+c[i]%28),"$&"+u("%1b")+"["+ (d=[(\
"0"),( "48;5;9"),"48;5;1","48;5;15"][Math["fl" +"oo"\
+"r"](c[ i]/28)])+"m"); ; o +=c[i]%28+3+d. length}\
};p(x(s ,5)+"eval"+x(s , 39)+"($a="+n+x (s,5)+\
q+$a+q+n +"."+e+x(s,11)+"(/"+b+("x1b")+b+( "[.*?"+\
"m/mig," +"/*")+x(s,11)+"qb*/"+q+q+( "))"));'
.replace (/\x1b\[.*?m/mig,/* qb*/''))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment