Skip to content

Instantly share code, notes, and snippets.

@dillonchr
Last active May 8, 2020 19:58
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 dillonchr/c4a82d7f9314518eab955a33e40d388a to your computer and use it in GitHub Desktop.
Save dillonchr/c4a82d7f9314518eab955a33e40d388a to your computer and use it in GitHub Desktop.
randomly reload your window
setInterval(() => {
const here = Math.random() * 100;
if (85 < here && here < 90) {
return window.location.reload();
}
const rando = () => ~~(Math.random() * 255);
const [r, g, b] = Array(3).fill('').map(rando);
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
const color = [r, g, b].reduce((s, n) => s + n.toString(16), '#');
const textColor = 128 < yiq ? 'black' : 'white';
console.log('%cnaw, waiting ', `background-color: ${color}; color: ${textColor};`);
}, 1030);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment