View replace-query-string.js
window.history.replaceState(null, null, `${location.pathname}?abcd=1234`);
View Github Master
# 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) {
.style('background', 'blue')
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`))

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>
<!-- 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="">
<!-- SCRIPTS -->