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 { AxiosResponse } from 'axios'; | |
import { logger } from 'firebase-functions'; | |
const retryPromise = ( | |
fn: () => Promise<AxiosResponse>, | |
retries = 2, | |
err: null | unknown = null | |
): Promise<AxiosResponse> => { | |
logger.log('Retries: ', retries); |
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
// Epochs | |
const epochs = [ | |
['year', 31536000], | |
['month', 2592000], | |
['day', 86400], | |
['hour', 3600], | |
['minute', 60], | |
['second', 1] | |
]; |
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 sortByPropertyName = ({ data, field = 'name' }) => | |
data.sort(function (a, b) { | |
var nameA = a[field].toUpperCase(); | |
var nameB = b[field].toUpperCase(); | |
if (nameA < nameB) return -1; | |
if (nameA > nameB) return 1; | |
return 0; | |
}); |
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 borderStyle = css` | |
border: solid 1px ${({ theme }) => theme.colors.neutral._40}; | |
`; | |
export const $TimelineCapsule = styled.div` | |
position: relative; | |
display: flex; | |
align-items: center; | |
justify-content: space-between; |
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
// Source: https://a-z-animals.com/animals/ | |
const allAnimals = { | |
Aardvark: true, | |
Aardwolf: true, | |
Abyssinian: true, | |
'Abyssinian Guinea Pig': true, | |
'Acadian Flycatcher': true, | |
'Achrioptera Manga': true, | |
'Ackie Monitor': true, | |
Addax: true, |
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 React, { useCallback, useEffect, useRef } from "react"; | |
function usePolling(action, delay) { | |
const timeoutId = useRef(null); | |
const isComponentMounted = useRef(false); | |
const handlePolling = useCallback(() => { | |
action().then(() => { | |
if (isComponentMounted.current) { | |
timeoutId.current = setTimeout(handlePolling, delay); |
OlderNewer