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": "🇺🇸" |
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; | |
}; |
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) { |
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 isFunction from 'lodash.isfunction'; | |
import type {SetStateAction} from 'react'; | |
type CallbackGeneric<S> = (newState: S) => void; | |
export type SetStateCallbackGeneric<S> = ( | |
x: SetStateAction<S>, | |
cb?: CallbackGeneric<S>, | |
) => void; |
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
# Fig pre block. Keep at the top of this file. | |
#[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh" | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/amerllica/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will |
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(); |
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; | |
}, []); |
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); |
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; |