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 map(arr, func) { | |
return arr.map(func); | |
} | |
// IF you are super particular about ordering | |
function parseCSV(csv) { | |
var peopleArray = csv.split('\n'); | |
var peopleArrayWithSplitNameElements = map(peopleArray, function(str){ | |
return str.split(','); | |
}) |
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 foo(a) { | |
return a() | |
} | |
function bar(a) { | |
return 1 | |
} | |
// I am passing bar in to foo. bar is a callback function to foo | |
function woof() { |
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
./node_modules/.bin/prettier --single-quote --trailing-comma all --write "{,!(node_modules)/**/}*.js" |
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
/** | |
Given two sorted arrays, merge them into one big sorted array | |
Ex: | |
merge([1,3,5],[2,4,6]) | |
returns [1,2,3,4,5,6] | |
You cannot use array.sort(). | |
Try to solve this in O(n+m) runtime. | |
Where n is the length of the first array | |
and m is the length of the second array. |
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
/** | |
https://lodash.com/docs/4.17.4#memoize | |
Create a function that saves previous results of past calls. | |
Example: | |
function add(x,y) { | |
return x + y | |
} | |
const memoizedAdd = memoize(add); |
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
/** | |
https://lodash.com/docs/4.17.4#flattenDeep | |
Recursively flattens array. | |
_.flattenDeep([1, [2, [3, [4]], 5]]); | |
// => [1, 2, 3, 4, 5] | |
Even if I nest an element 100 levels deep, it should still flatten it. | |
*/ |
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": { | |
"lint": "eslint server", | |
"lint:fix": "npm run lint -- --fix", | |
"prettier": | |
"./node_modules/.bin/prettier --single-quote --trailing-comma all --write \"{,!(node_modules|build|dist|flow-typed)/**/}*.js\"", | |
"prettierTS": | |
"./node_modules/.bin/prettier --single-quote --trailing-comma all --write \"{,!(node_modules|build|dist|flow-typed)/**/}*.ts\"", | |
"prettierTSX": | |
"./node_modules/.bin/prettier --single-quote --trailing-comma all --write \"{,!(node_modules|build|dist|flow-typed)/**/}*.tsx\"", |
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
const foobar = factors => | |
factors.map(factor => | |
factors.map(secondFactor => | |
factor * secondFactor | |
) | |
); | |
var foobar = function(factors) { | |
return factors.map(function(factor) { | |
return factors.map(function (secondFactor) { |
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 getBillingAddress({ | |
firstName, | |
lastName, | |
street, | |
addressLineTwo, | |
city, | |
state, | |
zip, | |
} ) { | |
return { |
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 * as React from 'react'; | |
import {withFeatureFlags} from './FeatureFlag' | |
@withFeatureFlags(['TEMP_20180523_123_DELETE_PAYMENTS']) | |
class EditPaymentDialog extends React.Component<{}, {}> { | |
render() { | |
const { featureFlags } = this.props; | |
const { TEMP_20180523_123_DELETE_PAYMENTS } = featureFlags; | |
if (TEMP_20180523_123_DELETE_PAYMENTS) return <div />; | |
return null; |