140charsJS (@140charsJS) profile picture

{ me: undefined }

Joined August 2011
Watch your semicolons! a=function(){alert("Doug is not right")} (function(){ alert("sometimes"); }()); Surprised? :-)
1
FF killer (no "stop script" popup when executed from FireBug): (function(){eval(arguments.callee.toSource())()})()
Email spam from M$-"Purchase VisualStudio"-link took me to: spe.atdmt.com/images/pixel.g…. I understood why VStudio and JSLint work well together...
If you place any tag between TDs (invalid HTML), IE will wrap it with mysterious empty tag (nodeType 1, tagName "") which is in fact CAPTION
document.getElementsByTagName("") can produce non empty result on bloody IE. For what HTLM tags?
Bartaz, your brain-based JS interpreter works perfectly! Yes, JSON.stringify in 139 chars. Dare to make it shorter or without limitations?
1
1
function x(o){s='';if(o&&Object(o)===o)for(k in o)s+=(s?",":o.pop?"][":"}{")+(+k+1?"":x(k)+':')+x(o[k]);return s?s.slice(1)+s[0]:'"'+o+'"'}
1
Right, @bartaz. So finally instead of +"1" on IE we are getting +"v1", which obviously is NaN. Then !NaN and voila!
Browser recognition sucks, but... interesting stuff: isIE = !+"\v1"; Do you understand how it works? :-)
1
Unfortunately V8 in current Node.JS(where I was testing)still don't have that change.But great Google realized it was a crap.Thx @reinmarpl
1
/js/i('140charsJS') - RegExp is callable object on V8 (works like exec method). Be careful: typeof /.+/ === 'function'
1
A=[].reduce,b="childNodes";A.call(document[b],function f(z,n){return Math.max(n.style?+n.style.zIndex:0,n[b]?A.call(n[b],f,z):0,z);},0);
Right, @bartaz - it is base62. The code found here: http://t.co/wWbpNGCz (after @140bytes) For sure can be optimized (yeah, that's for you)
function(a,b,c){for(a=a!==+a||a%1?-1:a,b="";a>=0;a=Math.floor(a/62)||-1)b=String.fromCharCode(((c=a%62)>9?c>35?29:87:48)+c)+b;return b}
1
Perfect, @bartaz - it is an object elements accessor. Example: f({a:{b:{c:[1,2]}}},'a.b.c.0') or f({a:{b:{c:[1,2]}}},'a.x.y.z')===undefined
function f(c,t){return t.split(".").reduce(function(o,p){return o&&p[p.length-1]==']'?p.split(/\[(.+?)\]/).reduce(f,o):(o&&p?o[p]:o)},c)}
2
112871563704136[[3,4,7].reduceRight.call("tdodSrtcroidneg",function(x,y,z){return z&1?x:y+x},"")]((Math.PI<<Math.PI)+(Math.PI<<Math.PI>>1))
Are ++ and -- bad parts? With dedication to Crockford (and everyone who would love to rename C++ with C+=1): a=-~a and a=~-a.
1
2
The last code snippet: place it at the beginning of your JS app to protect globals from being overwritten.Or change values to make a JS-bomb
[["undefined"],["NaN",0/0],["Infinity",1/0]].map(function(x){Object.defineProperty(this,x[0],{writable:0,configurable:0,value:x[1]})},null);
2
1
1