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
console.time('Number.toString'); | |
for (var i=0; i < 1000000; i++) { | |
Number.toString(i); | |
} | |
console.timeEnd('Number.toString'); | |
console.time('i.toString'); | |
for (var i=0; i < 1000000; i++) { | |
i.toString(); | |
} |
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 mockTime(val) { | |
Date = new Proxy(Date, { | |
construct: function(target, args) { | |
if (args.length === 0) { | |
return new target(val); | |
} | |
return new target(...args); | |
} | |
}); | |
} |
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
// using map - fastest! | |
const unkeyBy = (obj, prop) => { | |
const res = []; | |
Object.keys(obj).map((x, i) => res[i] = { ...obj[x], [prop]: x }); | |
return res; | |
}; | |
// adds ungrouping | |
const ungroupBy = (obj, prop) => { | |
const res = []; |
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
{ | |
"jest": { | |
"testEnvironment": "node", | |
"transform": { | |
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | |
}, | |
"testRegex": "test/.*\\.(ts)$", | |
"modulePaths": ["<rootDir>/src"], | |
"moduleFileExtensions": [ | |
"ts", |
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
{ | |
"devDependencies": { | |
"ghooks": "latest" | |
}, | |
"config": { | |
"ghooks": { | |
"post-merge": "./hooks/post-merge.sh" | |
} | |
} | |
} |
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
var fs = require('fs') | |
var _ = require('lodash') | |
var humps = require('humps') | |
var input = require('./input.json') | |
var outputFile = './output.json' | |
function processObj(val) { | |
if (_.isArray(val)) { | |
return val.map(item => processObj(item)) | |
} |
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
import { createAction } from 'redux-actions' | |
export const SOME_ACTION = 'SOME_ACTION' | |
export const ANOTHER_ACTION = 'ANOTHER_ACTION' | |
const actionCreators = { | |
someAction: () => createAction(SOME_ACTION/*, ...*/), | |
anotherAction: () => createAction(ANOTHER_ACTION/*, ...*/) | |
} |
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
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
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 | |
# USAGE: | |
# ./ec2ssh.sh <tag:name> <instance_num> [<remote_command>] | |
if [ $# -lt 2 ] | |
then | |
echo "Usage: `basename $0` <tag:name> <instance_num>" | |
exit 1 | |
fi |
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 | |
mkdir -p ~/.aws | |
echo -e "[default]\naws_access_key_id=$AWS_ACCESS_KEY_ID\naws_secret_access_key=$AWS_SECRET_ACCESS_KEY" > ~/.aws/credentials |
NewerOlder