Skip to content

Instantly share code, notes, and snippets.

View Raysharr's full-sized avatar

Michał Czekała Raysharr

  • MAKE IT SIMPLE
  • Poland, Poznań
View GitHub Profile
@Raysharr
Raysharr / better_setInterval.js
Created October 18, 2012 20:50
Paul Irish's better setInterval
/* From Paul Irish */
/* instead of */
setInterval(function(){ doStuff(); },100);
/* use anonymous self-executing function */
(function thisismyfunctionuniquename(){
doStuff();
setTimeout(thisismyfunctionuniquename,100);
@Raysharr
Raysharr / gist:3914595
Created October 18, 2012 20:44 — forked from maxvipon/jquery-pubsub.js
JavaScript: PubSub [jquery]
/* @paul_irish Pub/Sub
* Works in modern browsers + IE9
* Use Modernizr ployfill for function.bind */
(function($) {
var o = $({});
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
}(jQuery));