Skip to content

Instantly share code, notes, and snippets.

@WhoAteDaCake
Last active August 28, 2018 09:55
Show Gist options
  • Save WhoAteDaCake/15efca5020b6fa26dcf9cfb11a5f1418 to your computer and use it in GitHub Desktop.
Save WhoAteDaCake/15efca5020b6fa26dcf9cfb11a5f1418 to your computer and use it in GitHub Desktop.
const removeUnless = (key) => {
Array.from(document.querySelector('.nav-stacked').children).map(item => {
if (item.dataset.category !== key) {
item.parentNode.removeChild(item);
}
})
}
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment