Skip to content

Instantly share code, notes, and snippets.

@remy
Created December 29, 2009 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save remy/265552 to your computer and use it in GitHub Desktop.
Save remy/265552 to your computer and use it in GitHub Desktop.
// because I just needed the function to run once, then assign it -
// I knew that I'd never need to run it manually again, so here I
// extended the Function prototype :)
Function.prototype.runReturn = function () {
this.call();
return this;
};
// for example:
$(document).on('orientationchange', function () {
$('body').removeClass('portrait landscape').addClass(window.innerWidth < window.innerHeight ? 'portrait' : 'landscape');
}.runReturn());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment