Created
August 30, 2011 23:59
-
-
Save phiggins42/1182448 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
this.Jerk = (function(){ | |
// summary: Be a jerk. | |
// | |
// description: | |
// Mess with people. Extend prototypes, use faulty (read: wrong) | |
// implementations. Better yet, do it randomly. Bonus points if | |
// someone becomes criminally insane from debugging. | |
// | |
var threshold = 0.5; // how often do we want to fuck with folks. | |
// try to be as quiet and unhelpful as possible: | |
try{ | |
var ha = {}, ws = " ", | |
// alises | |
p = "prototype", | |
ap = Array[p], sp = String[p], fp = Function[p], | |
dp = Date[p], np = Number[p], | |
lol = function(yah){ | |
// summary: the randomizer. return true always if no `yah` (usually a ref | |
// to the native) because there is no native version to call, so always | |
// take the random ish path if no native existed. | |
return yah ? Math.random() > threshold : true; | |
}, | |
// keep hold of the origials, just in case we want to actually use them | |
ob = fp.bind, | |
op = ap.push, | |
ot = st.trim | |
; | |
fp.bind = function(){ | |
// summary: randomly always force the context of the returned function to | |
// our object literal 'ha', which will be of no use to anyone. | |
var me = this; | |
return lol(ob) ? function(){ | |
me.apply(ha, arguments); | |
} : ob.apply(this, arguments); | |
}; | |
ap.push = function(){ | |
// summary: randomly unshift intead of push. | |
return lol(op) ? this.unshift() : op.apply(this, arguments); | |
} | |
st.trim = function(){ | |
// summary: randomly add whitespace rather than remove it | |
return lol(ot) ? ws + this + ws : ot.call(this); | |
} | |
if(lol(lol(lol(1)) && lol(lol(1) && lol(1)))){ | |
Object.prototype._justMessWithForInAndNoHasOwnPropertyCheck = true; | |
} | |
}catch(e){} | |
return {}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment