Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
Created May 9, 2011 16:58
Show Gist options
  • Save michealbenedict/962876 to your computer and use it in GitHub Desktop.
Save michealbenedict/962876 to your computer and use it in GitHub Desktop.
Number.method('integer', function ( ) {
return Math[this < 0 ? 'ceil' : 'floor'](this);
});
String.method('trim', function ( ) {
return this.replace(/^\s+|\s+$/g, '');
});
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment