Skip to content

Instantly share code, notes, and snippets.

@silentrob
Created January 20, 2010 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silentrob/282023 to your computer and use it in GitHub Desktop.
Save silentrob/282023 to your computer and use it in GitHub Desktop.
Repeat = {};
Repeat.__noSuchMethod__ = function __noSuchMethod__ (id, args) {
var numTimes = /x([0-9]+)/.exec(id);
if (numTimes != null) {
for (var i = 0;i < numTimes[1]; i++) {
if (typeof args[0] == 'function') {
args[0]();
} else {
system.console.log(args[0]);
}
}
}
};
Repeat.x10( function(){ system.console.log("Run this code")} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment