Git

Discard unstaged changes

git checkout -- .

Javascript

Arrays

Easily convert NodeList/HTMLCollection to Array with ES6 spread operator

const arr = [...document.querySelectorAll('div')];

Quickly create a number of items in an Array

Array.apply(null, { length: 20 }).map(() => 'foo')

DOM

Programmatically focus an element by adding tabindex="0" to it and fire this.el.focus()