Skip to content

Instantly share code, notes, and snippets.

@sugyan sugyan/qb.js
Created May 19, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.