Skip to content

Instantly share code, notes, and snippets.

@Rendez
Created January 21, 2014 12:01
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 Rendez/8538785 to your computer and use it in GitHub Desktop.
Save Rendez/8538785 to your computer and use it in GitHub Desktop.
Ruby port of 'times' function in jquery
$.fn.times = function(callback) {
var i = 0;
do { callback(i); } while (this[0] > ++i);
};
@Rendez
Copy link
Author

Rendez commented Jan 21, 2014

If a scope and arguments are needed to pass to callback(), then use $.proxy.

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