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
| export const clearDecimals = (value: number, digits: number = 2) => { | |
| if (digits === 0) { | |
| return parseInt(value.toString()) | |
| } | |
| return Number(value.toFixed(digits)) | |
| } |
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 requires nanoid to be installed to work | |
| -- https://github.com/viascom/nanoid-postgres | |
| CREATE EXTENSION IF NOT EXISTS pgcrypto; | |
| CREATE OR REPLACE FUNCTION prefixedid( | |
| prefix text, | |
| size int DEFAULT 24, | |
| alphabet text DEFAULT '0123456789abcdefghijklmnopqrstuvwxyz' | |
| ) |
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
| interface GraphQLResponse { | |
| data: unknown | |
| } | |
| const noqlFetcher = async <T>( | |
| endpoint: string, | |
| query: string, | |
| variables?: object, | |
| headers: object = {} | |
| ): Promise<T> => { |
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
| // Check if Gitmoji is being used in Commits | |
| const regex = | |
| /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi | |
| danger.git.commits.forEach((commit) => { | |
| const hasGitmoji = regex.test(commit.message) | |
| if (!hasGitmoji) { | |
| warn(`Please use gitmojis in commits.`) | |
| } | |
| }) |
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
| /** | |
| * useOrientation custom hook | |
| * Usage: | |
| * const { orientation } = useOrientation(); | |
| */ | |
| import { useState, useEffect } from "react" | |
| const useOrientation = () => { | |
| const [orientation, setOrientation] = useState< | |
| "portrait" | "landscape" | undefined |
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
| git fetch -p && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D |
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 { useState, useEffect } from "react" | |
| type SSRRect = { | |
| bottom: number | |
| height: number | |
| left: number | |
| right: number | |
| top: number | |
| width: number | |
| x: number |
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
| export interface Country { | |
| name: string | |
| code: string | |
| } | |
| export const CountryList: Country[] = [ | |
| { name: "Afghanistan", code: "AF" }, | |
| { name: "Albania", code: "AL" }, | |
| { name: "Algeria", code: "DZ" }, | |
| { name: "American Samoa", code: "AS" }, |