Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created April 22, 2011 16:38
Show Gist options
  • Save cowboy/937006 to your computer and use it in GitHub Desktop.
Save cowboy/937006 to your computer and use it in GitHub Desktop.
JavaScript: Duck Punching vs Dick Punching
// Duck Punching.
window._alert = window.alert;
window.alert = function(n) {
return typeof n === 'number'
? window._alert('QU' + Array(n + 1).join('A') + 'CK')
: window._alert.apply(window, arguments);
};
// Dick Punching.
window._alert = window.alert;
window.alert = function(n) {
return typeof n === 'number'
? window._alert('8' + Array(n + 1).join('=') + 'D')
: window._alert.apply(window, arguments);
};
@cowboy
Copy link
Author

cowboy commented Apr 22, 2011

Note: don't try to duck punch and dick punch the same function or you'll end up with a very, very angry duck.

@furf
Copy link

furf commented Apr 22, 2011

// Duck pinching
location.href="http://furf.it/6O";

// Dick pinching
return; // will not go there

@cowboy
Copy link
Author

cowboy commented Apr 22, 2011

Hahaha awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment