View ComputedStyleResponsiveDesign.js
const { width, height } = window.getComputedStyle(document.querySelector(`.someElemClass`))
View destructuring-in-es6.md

Given the data structure:

const person = {
  first: 'Wes',
  last: 'Bos'
}

You can extract out the variables with this destructuring syntax:

View .gitignore
# tsconfig.json # For example ignore a TypeScript file used in the build process
.gitignore # Ignore this new .gitignore file as we don't wish to commit it into the repo (since its just for local development)
View running-jasmine-tests-in-the-browser.html
<!DOCTYPE html>
<html>
<head>
<!-- META DATA -->
<meta name="description" content="Running Jasmine tests in the browser">
<meta charset="utf-8">
<title>Running Jasmine tests in the browser</title>
<!-- STYLES -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.5.2/jasmine.min.css">
<!-- SCRIPTS -->
View array-methods-in-javascript-filter-map-reduce.js
var data = ['apple', 'pear', 'orange', 'orange', 'apple', 'lime', 'lime'];
data
.filter((elem, index, array) => elem !== 'pear') /* Let's filter out all pears (as they are horrible!) */
.reduce((total, elem, index, array) => {
if (total.indexOf(elem) === -1) total.push(elem); // Only add unique items to the array (de-duplication)
return total; // Return the cumulative total
}, [] /* Initial value, can be any primitive e.g. [], boolean etc */)
.map((elem, index, array) => elem + ' juice') /* Add the word 'juice' to the end */
.reduce((total, elem, index, array) => {
View zoom-and-pan.css
transform: scale(2); /* Zoom in by 100% */
transform-origin: 50% 50%; /* Pan to the center of the screen */
-webkit-transform: scale(2); /* Zoom in by 100% */
-webkit-transform-origin: 50% 50%; /* Pan to the center of the screen */
View elem-class-toggle.js
var elem = document.querySelector('.some-important-element');
var bool = false;
elem.classList.toggle('class-I-want-to-add-or-remove', bool);
View CSS Font-Size Units
1em (variable) = 12pt (fixed) = 16px (fixed) = 100% (variable)
View forWithDelay.md
View addTrackedListener.js
// Link: http://www.jimmycuadra.com/posts/keeping-track-of-javascript-event-handlers/
function addTrackedListener(element, type, handler) {
if (!element.trackedEvents) {
element.trackedEvents = {};
}
if (!element.trackedEvents[type]) {
element.trackedEvents[type] = [];