View replace-query-string.js
window.history.replaceState(null, null, `${location.pathname}?abcd=1234`);
View Github Master Rebase.md
# Rebase the master branch
git checkout master
git pull --rebase
# Checkout the branch you want to rebase with master
git pull --rebase origin master
View add-event.js
/**
* @param element The element to add the event
* @param type Event type (i.e. 'click')
* @param callback Function to execute when event is triggered
*/
function (element, type, callback) {
try {
element.addEventListener(type, callback, false);
} catch (e) {
element.attachEvent('on' + type, callback);
View typescript-2.x-string-enum.ts
export enum ExampleStringEnum {
PROPERTY_A = 'property-a' as any as ExampleStringEnum,
PROPERTY_B = 'property-b' as any as ExampleStringEnum,
}
View d3-transition-as-named-function.js
function myTransitionSettings(transition) {
transition
.delay(0)
.duration(100)
.style('background', 'blue')
}
d3.transition().call(myTransitionSettings)
View check-scheduled-transitions-in-D3.js
function checkScheduledTransitions(element) {
const transitions = element.__transition
if (transitions) {
return Object.keys(transitions).length
} else {
return false
}
}
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 -->