Skip to content

Instantly share code, notes, and snippets.

View GabeStah's full-sized avatar

Gabe Wyatt GabeStah

View GitHub Profile
@GabeStah
GabeStah / paperclips.js
Last active August 15, 2018 05:38 — forked from cowboy/paperclips.js
Universal Paperclips: stuff to paste into console http://www.decisionproblem.com/paperclips
_toggles = {}
makeToggle = (id, fn, delay = 100) => {
const elem = document.querySelector('#' + id)
elem.onclick = () => {
if (_toggles[id]) {
clearInterval(_toggles[id])
_toggles[id] = null
} else {
_toggles[id] = setInterval(() => elem.disabled || fn(), delay)
}