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 groupBy = (array, groupKey) => { | |
| return array.reduce((acc, cur) => { | |
| if (acc[cur[groupKey]]) { | |
| acc[cur[groupKey]].push(cur); | |
| } else { | |
| acc[cur[groupKey]] = [cur]; | |
| } | |
| return acc; | |
| }, {}); | |
| }; |
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
| Have you worked in an agile or scrum environment? Tell us about your experience. | |
| Have you lead teams before and if so what is your approach to leadership? | |
| What do you expect from a team that you are apart of? | |
| Any experience pair programming? | |
| What is your biggest strength you can contribute to a team? | |
| What is a recent technical challenge you experienced and how did you solve it? | |
| How are you keeping up with the latest developments in web development? | |
| Design vs. Implementation what is your process? |
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 keyBy = (arr, objKey) => arr.reduce( | |
| (acc, cur) => ( | |
| { ...acc, [cur[objKey]]: cur } | |
| ), {}); |
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 toDollar(n) { | |
| const numWithCommas = n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
| return `$${numWithCommas}`; | |
| } |
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
| export const composePromise = (...fns) => initialValue => | |
| fns.reduceRight((res, fn) => Promise.resolve(res).then(fn), initialValue); | |
| // Individual Promises | |
| const saveAppFee = () => saveFees(a, b, c); | |
| const saveLnpFee = () => saveFees(x, y, z); | |
| // Composed Promises | |
| const saveAppAndLnp = composePromise(saveAppFee, saveLnpFee); | |
| const saveApp = composePromise(saveAppFee); |
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
| // Arrow | |
| const buildMockArray = <T>(num: number, content: T): T[] => Array(num).fill(null).map(() => content); | |
| // Traditional | |
| function buildMockArray<T>(num: number, content: T): T[] { | |
| return Array(num).fill(null).map(() => content); | |
| } |
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
| { | |
| "Stateless Functional Component": { | |
| "prefix": "stateless", | |
| "body": [ | |
| "import React from 'react';", | |
| "import PropTypes from 'prop-types';", | |
| "", | |
| "const ${TM_FILENAME_BASE/(.*)\\..+$/$1/} = () => {", | |
| " return <div className=\"\"></div>;", | |
| "}", |
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
| // From https://stackoverflow.com/questions/286141/remove-blank-attributes-from-an-object-in-javascript | |
| const removeEmpty = (obj) => { | |
| return Object.keys(obj) | |
| .filter(k => obj[k] !== null && obj[k] !== undefined && obj[k] !== '') | |
| .reduce((newObj, k) => { | |
| return typeof obj[k] === 'object' ? | |
| Object.assign(newObj, {[k]: removeEmpty(obj[k])}) : // Recurse. | |
| Object.assign(newObj, {[k]: obj[k]}); // Copy value. | |
| }, {}); | |
| } |
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 flattenFilePath = (pathPart, directoryOrFileContents) => { | |
| return Object.entries(directoryOrFileContents).reduce((flattenedFilePaths, [key, value]) => { | |
| if (typeof value === "object") { | |
| Object.assign(flattenedFilePaths, flattenFilePath(`${pathPart}/${key}`, value)) | |
| } else { | |
| flattenedFilePaths[`${pathPart}/${key}`] = value | |
| } | |
| return flattenedFilePaths | |
| }, {}) |
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 fs = require('fs'); | |
| // Paths functions from | |
| // https://lowrey.me/getting-all-paths-of-an-javascript-object/ | |
| function getPaths(root) { | |
| let paths = []; | |
| let nodes = [{ | |
| obj: root, | |
| path: [] |