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
[alias] | |
s = status | |
d = diff | |
c = checkout | |
co = commit | |
ps = push | |
l = log | |
p = pull | |
b = branch | |
[user] |
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
// I like how this approach lets me test my hook as if it's a pure function, | |
// but something about this feels weird 🤔 🤫 | |
test('use-validation', () => { | |
let counter = 0 | |
render( | |
<Test> | |
{fields => { | |
const fooFuncs = { | |
onChange: fields.foo.onChange, |
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
import React from 'react' | |
import { render, fireEvent } from 'react-testing-library' | |
import useValidation from '..' | |
describe('use-validation', () => { | |
const Test = ({ mockFunc, handleSubmit }) => { | |
const { fields } = useValidation({ | |
fields: { | |
foo: '', | |
bar: '', |
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 convertToRomanNumerals = int => { | |
const romanNumerals = ['I', 'V', 'X', 'L', 'C', 'D', 'M'] | |
const createRomanNumeralRange = (I, V, X) => [ | |
'', | |
I, | |
`${I}${I}`, | |
`${I}${I}${I}`, | |
`${I}${V}`, | |
V, | |
`${V}${I}`, |
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
/** | |
* Given an array of Person objects, returns the root PersonTreeNode (the CEO). | |
* @param {Person[]} employees - An array of Person objects representing all the employees of the company. | |
* @returns {PersonTreeNode} The CEO of the organization. | |
*/ | |
function generateTree(employees) { | |
let ceo = null | |
const visitedById = new Map() | |
const visitedByManagerId = new Map() |
OlderNewer