This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gist adapted from: https://gist.github.com/cms/369133 | |
export getStyle(el: Element, styleProp: string): string { | |
let value; | |
const defaultView = el.ownerDocument.defaultView; | |
// W3C standard way: | |
if (defaultView && defaultView.getComputedStyle) { | |
// sanitize property name to css notation (hypen separated words eg. font-Size) | |
styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase(); | |
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); | |
} else if (el['currentStyle']) { // IE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on: https://github.com/observing/pre-commit/issues/50 | |
# Stash modified files, but keep the index tree | |
git stash -q --keep-index | |
# 1. Run diff for tree index withtou create a new index tree, showing only files names and iff the file was added or copied or deleted or renamed. | |
# 2. Grep only for .ts files | |
# 3. Execute tslint for each file that was modified with type checking enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "\nChecking for console.logs()...\n" | |
# Get from http://frontend.turing.io/lessons/module-4/git-hooks.html | |
exec 1>&2 | |
# enable user input | |
exec < /dev/tty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const pjson = require('../package.json'); | |
const depsStr = JSON.stringify(pjson.dependencies); | |
const devDepsStr = JSON.stringify(pjson.devDependencies); | |
const allDepsStr = depsStr + devDepsStr; | |
console.log(crypto.createHash('md5').update(allDepsStr).digest("hex")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty="%s" | grep -o -P '(?<=\().*(?=\))' | grep -v -F 'pull request' | uniq |