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
name: "🐛 Bug Report" | |
description: Create a new ticket for a bug. | |
title: "🐛 [BUG] - <title>" | |
labels: [ | |
"bug" | |
] | |
body: | |
- type: textarea | |
id: description | |
attributes: |
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
// takes either a unix time number, string or a Date object and returns time string | |
export const timeAgo = (time: number | string | Date) => { | |
switch (typeof time) { | |
case "number": | |
break; | |
case "string": | |
time = +new Date(time); | |
break; | |
case "object": |
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 DefaultRenderAnimationOutput = ({name, count}) => { | |
return ( | |
<> | |
<span className="RenderAnimation-name">{name} </span> | |
<span className="RenderAnimation-count">{count}</span> | |
</> | |
); | |
}; | |
function useRenderAnimation( |
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 { mkdirSync, readFileSync, writeFileSync } from 'fs'; | |
import glob from 'glob'; | |
import path from 'path'; | |
const globAsync = (pattern: string): Promise<string[]> => | |
new Promise<string[]>((res, rej) => | |
glob(pattern, (err, matches) => (err ? rej(err) : res(matches))), | |
); | |
const paths = await globAsync('src/**/*.ts'); |
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
/** | |
* I started building this, then came across a more robust solution: | |
* {@link https://github.com/therealparmesh/object-to-formdata} | |
*/ | |
import { isPlainObject } from "is-plain-object"; | |
type Value = string | Blob | number | boolean | null | undefined | Date; | |
function convert<T extends Value>(value: T): string | Blob { |
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 pino from "pino"; | |
const logger = pino({ | |
serializers: { | |
req(req: any) { | |
return { | |
method: req.method, | |
headers: req.headers, | |
ip: req.ip, | |
url: req.url, |
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 {jsx, jsx as jsxs, jsx as Fragment} | |
type DOMElement = Element; | |
declare global { | |
namespace JSX { | |
type Element = DOMElement; | |
type ChildElement = string | number | boolean | symbol | bigint | null | undefined | { toString(): string } | (() => ChildElements) | Node; | |
type ChildElements = ChildElement | Iterable<ChildElement>; | |
interface HTMLAttributes<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
//const pinoInspector = require("pino-inspector"); | |
const path = require("path"); | |
const fastify = require("fastify")({ | |
//logger: { prettyPrint: true, level: "debug", prettifier: pinoInspector }, | |
ajv: { | |
plugins: [[require("ajv-keywords"), ["transform"]]], | |
}, | |
}); | |
fastify.register(require("@fastify/multipart")); |
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
// ------------ useState => dealing with multiple object in state | |
const [person ,setPerson] = useState(() => initialPerson); | |
setPerson((person) => ({ | |
...person, | |
firstName: e.target.value | |
})); |
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 copyToClipboard = (text) => navigator.clipboard?.writeText && navigator.clipboard.writeText(text); | |
copyToClipboard("Hello World!"); |