Skip to content

Instantly share code, notes, and snippets.

@makenova
makenova / Difference between debounce and throttle.md
Last active February 22, 2023 03:09
Javascript function debounce and throttle

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@makenova
makenova / InjectBigWiki.js
Last active December 25, 2015 08:28
A bookmarklet that hides all the sidebar and header crap on wikipedia, it puts the content front and center with the find bar in the top right corner so you can navigate to other articles.
javascript:(function(){
_my_script=document.createElement('script');
_my_script.type='text/javascript';
_my_script.src='https://gist.github.com/makenova/6946529/raw/46390be80f63d4269602231d79fe2e952559ccbd/bigwiki.js';
document.getElementsByTagName('head')[0].appendChild(_my_script);
})();