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 formatDollarAmount = (num) => ( | |
'$' + `${Math.floor(num)}` | |
.split('') | |
.reverse() | |
.reduce((result, char, index) => { | |
index > 0 && !(index % 3) && result.push(','); | |
return [...result, char] | |
}, []) | |
.reverse() | |
.join('') + `${(num % 1).toFixed(2)}`.substr(1) |
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
/* Move footer to the top so it doesn't get obscured behind Windows 10's notifications */ | |
#client_body:not(.onboarding):not(.feature_global_nav_layout)::before { | |
display: none; | |
} | |
#col_messages { | |
flex-direction: column-reverse !important; | |
} |
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
export function omitSingle(object = {}, key) { | |
if (key === null || key === undefined || !(key in object)) return object; | |
const { [key]: deleted, ...otherKeys } = object; | |
return otherKeys; | |
} | |
export function omitMultiple(object = {}, keys) { | |
if (!Array.isArray(keys)) return object; | |
return keys.reduce((result, key) => { | |
if (key in result) { |
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
function fibonacci(n) { | |
return Math.round((Math.pow(1.618033988749895, n) - Math.pow(-0.618033988749895, n)) / 2.23606797749979); | |
} |
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, { useEffect, useState } from 'react'; | |
function useActiveValidation(value, validator) { | |
const [isValid, setIsValid] = useState(true); | |
useEffect(() => { | |
setIsValid(validator(value)); | |
}, [value]); | |
return isValid; |
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, { useEffect, useState } from 'react'; | |
function usePassiveValidation(value, validator) { | |
const [valid, setValid] = useState(true); | |
const [checkValue, setCheckValue] = useState(null); | |
const [didMount, setDidMount] = useState(false); | |
function validate() { | |
setCheckValue(value); |
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
cd {localRepo} | |
git subtree add --prefix {localFolder} {otherRepoUrl} {otherRepoBranch} |
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
// Original | |
tagClick = (tag) => { | |
let newSpecialties = this.state.specialties.slice(); | |
let specialties = (filter(newSpecialties, (option) => { | |
return !isEqual(option, tag); | |
})); | |
this.setState({ specialties }); | |
} | |
// 1. Variables are not being reassigned, so they should be consts |
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
// Original | |
function clearTempStatuses(state) { | |
if (state == null) return []; | |
return state.map((quote) => { | |
const options = quote.options.map((option) => { | |
const { tempStatus: optionTempStatus, ...optionWithoutTempStatus } = option; | |
if (optionTempStatus) { | |
return { ...optionWithoutTempStatus, status: optionTempStatus }; | |
} | |
return optionWithoutTempStatus; |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
OlderNewer