This file contains hidden or 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
// http://benalman.com/news/2010/11/immediately-invoked-function-expression/ | |
// defining functions | |
// 1. function declaration | |
function f1() { | |
console.log('i do declare'); | |
} | |
// 2. function expression |
This file contains hidden or 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
// Open Questions | |
// Q: Should we use void 0 or undefined? | |
// --- | |
// A: Very old versions of JS allow for assigning to `undefined`, which was an argument for preferring `void 0`, | |
// but strict mode will throw an error on attempted assignment to non-writeable properties (like `undefined`) | |
// --- | |
// tldr; `void 0` is JS trivia, prefer more expressive and totally safe `undefined` | |
// ---- |
This file contains hidden or 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
// Rules added | |
// --- | |
// 1. yoda | |
// http://eslint.org/docs/rules/yoda | |
// --- | |
// a: bad | |
if ('red' === color) { ... } | |
// b: good (readability) | |
if (color === 'red') { ... } |
This file contains hidden or 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
function pluralizer(strings, ...values) { | |
// `strings` is [ 'I ate ', ' ' ] | |
let output = [] | |
suffix = '' | |
if (values[0] !== 1) { | |
suffix = 's' | |
} | |
This file contains hidden or 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
{ | |
"extends": "airbnb/base", | |
"rules": { | |
"array-bracket-spacing": [ "warn", "always", { "singleValue": false, "objectsInArrays": false, "arraysInArrays": false } ], | |
"camelcase": "warn", | |
"indent": [ "warn", 4, { "SwitchCase": 1 } ], | |
"max-len": 0, | |
"no-dupe-keys": "error", | |
"no-nested-ternary": "warn", | |
"no-fallthrough": "warn", |
This file contains hidden or 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
#!/usr/bin/env python | |
import sys, os, re | |
from subprocess import check_output | |
# Collect the parameters | |
commit_msg_filepath = sys.argv[1] | |
# Figure out which branch we're on | |
branch = check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip() |
This file contains hidden or 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 | |
# First confirm we actually have commits to push | |
commits=`git log @{u}..` | |
if [ -z "$commits" ]; then | |
exit 0 | |
fi | |
# Get OX-specific test command | |
# Assume not Mac OSX by default |
This file contains hidden or 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
"scripts": { | |
"start": "node index", | |
"dev": "node_modules/.bin/webpack", | |
"build": "node_modules/.bin/webpack -p", | |
"test:base": "mocha --recursive --compilers js:babel/register --no-timeouts", | |
"test:base-watch": "mocha -w --recursive --compilers js:babel/register --no-timeouts", | |
"test:base-silent": "npm run test:base 1>&- 2>&-", | |
"test:nowatch": "export NODE_ENV=test&& npm run test:base-silent", | |
"test:nowatch-win": "set NODE_ENV=test&& npm run test:base-silent", | |
"test": "export NODE_ENV=test&& npm run test:base-watch", |
This file contains hidden or 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 | |
# Confirm we actually have commits to push | |
commits=`git log @{u}..` | |
if [ -z "$commits" ]; then | |
exit 0 | |
fi | |
LOG="[pre-push]" |
This file contains hidden or 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 | |
LOG="[post-commit]" | |
unlinted=`grep eslint-disable $(git diff-tree --no-commit-id --name-only -r HEAD~1) -H` | |
if [ -z "$unlinted" ]; then | |
tput setaf 2; echo "$LOG no lint-disabled files found in commit" | |
else | |
tput setaf 3; echo "$LOG WARNING: lint-disabled files detected in commit" |
OlderNewer