View currencies_country_flags.json
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
[ | |
{ | |
"name": "US Dollar", | |
"symbol": "$", | |
"symbolNative": "$", | |
"decimalDigits": 2, | |
"rounding": 0, | |
"code": "USD", | |
"namePlural": "US dollars", | |
"countryEmoji": "🇺🇸" |
View deviceDetector.ts
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 type NameVersion = { | |
name: string; | |
version: number; | |
}; | |
export type DeviceDetector = { | |
os: NameVersion; | |
browser: NameVersion; | |
}; |
View useHorizontalScroll.ts
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 { useEffect } from 'react'; | |
import type { MutableRefObject } from 'react'; | |
const useHorizontalScroll = ( | |
scrollWrapperRef?: MutableRefObject<HTMLElement | undefined>, | |
scrollSpeed = 1 | |
): void => { | |
useEffect(() => { | |
const horizWrapper = scrollWrapperRef?.current; | |
if (horizWrapper?.style) { |
View useStateCallback.ts
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 { useRef, useCallback, useEffect, useState } from 'react'; | |
import type { Dispatch, SetStateAction } from 'react'; | |
type StateFunctionType<S> = Dispatch<SetStateAction<S | undefined>>; | |
type SetStateCallbackGeneric<S> = ( | |
x: S | StateFunctionType<S>, | |
cb?: Function | |
) => void; | |
const useStateCallback = <T>( |
View .zshrc
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 ANDROID_HOME=/Users/amerllica/Library/Android/sdk | |
export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home | |
export PATH=$JAVA_HOME:$PATH | |
export PATH=$ANDROID_HOME/platform-tools:$PATH | |
export PATH=$ANDROID_HOME/tools:$PATH | |
export PATH=$ANDROID_HOME/emulator:$PATH |
View server.ts
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 jwt = require("jsonwebtoken"); | |
const secret = process.env.JWT_SECRET; | |
export const authCheck = (req, res, next) => { | |
if (req.headers.authorization) { | |
const token = req.headers.authorization; | |
jwt.verify(token, secret, (err, decoded) => { | |
if (err) { | |
res.send(401); | |
} else { | |
next(); |
View shuffler.js
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 shuffler = array => array.reduce((accumulator, currentValue) => { | |
const randomIndex = Math.ceil(Math.random() * 10); | |
accumulator.splice(randomIndex, 0 ,currentValue); | |
return accumulator; | |
}, []); |
View debounce.js
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 searchInput = document.getElementById('search-input'); | |
const searchText = document.getElementById('search-text'); | |
const debounce = (func, wait = 100) => { | |
let timeout; | |
return (...args) => { | |
clearTimeout(timeout); | |
timeout = setTimeout(() => { | |
func.apply(this, args); | |
}, wait); |
View EuclidTree.js
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 euclidTree = (width = 100, height = 100) => { | |
const body = document.body; | |
const canvas = document.createElement('canvas'); | |
canvas.width = width; | |
canvas.height = height; | |
body.appendChild(canvas); | |
const ctx = canvas.getContext("2d"); | |
const branch = (size, angle) => { | |
size < 10 ? ctx.strokeRect(0, 0, size, size) : ctx.fillRect(0, 0, size, size); | |
if (size < 2) return; |