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 faultyKeeb(str) { | |
for (let i = 0; i < str.length; ++i) { | |
if (['a', 'e', 'i', 'o', 'u'].includes(str[i])) { | |
str = Array.from(str.slice(0, i)).reverse().join('') + str.slice(i+1, str.length); | |
} | |
} | |
return str; | |
}; |
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 useTimer(endTime: string, disableDays = false): [number, number, number, number] { | |
const [days, setDays] = useState<number>(0); | |
const [hours, setHours] = useState<number>(0); | |
const [minutes, setMinutes] = useState<number>(0); | |
const [seconds, setSeconds] = useState<number>(0); | |
useEffect(() => { | |
const timer = (interval: number): void => { | |
const countDownDate = new Date(endTime).getTime(); | |
const now = new Date().getTime(); |
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
/* | |
* Hook to reuse state logic for api calls | |
* | |
*/ | |
function useApiCall(api: AxiosInstance, params: any[], onError: any => any) { | |
const [data, setData] = useState(null); | |
const [isLoading, setIsLoading] = useState(false); | |
const [error, setError] = useState(null); | |
useEffect(async () => { |
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
// this script is used to: | |
// - rename .js files to .tsx and .ts | |
// - remove "// @flow" from top of files | |
// script is unsafe | |
// run from root of project | |
const fs = require('fs'); | |
const path = require('path'); | |
const dirPath = 'components'; |