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
type Prettify<T> = { | |
[K in keyof T]: T[K]; | |
} & {} |
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 { useRouter, useSearchParams, usePathname } from 'next/navigation'; | |
import { useEffect, useState } from 'react'; | |
type UseSearchParamStateReturn<T> = [T, (newValue: T) => void]; | |
const useSearchParamState = <T>(param: string, defaultValue: T): UseSearchParamStateReturn<T> => { | |
const router = useRouter(); | |
const pathname = usePathname(); | |
const searchParams = useSearchParams(); | |
const [value, setValue] = useState<T>(defaultValue); |
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
"use client"; | |
import React, { useEffect, useRef, useCallback } from "react"; | |
type IFittyProps = { | |
children: React.ReactNode; | |
minSize?: number; | |
maxSize?: number; | |
multiLine?: boolean; | |
}; |
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 } from 'react'; | |
const ImageMagnifier = ({ | |
src, | |
className, | |
width, | |
height, | |
alt, | |
magnifierHeight = 150, | |
magnifierWidth = 150, |
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
// from https://github.com/react-component/picker/pull/230 | |
import { DateTime, Info } from 'luxon'; | |
import type { GenerateConfig } from 'rc-picker/lib/generate'; | |
/** | |
* Normalizes part of a moment format string that should | |
* not be escaped to a luxon compatible format string. | |
* | |
* @param part string |
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: Vercel Deployment | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
Deploy-Production: |
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 { resolve } from "path"; | |
export default { | |
build: { | |
rollupOptions: { | |
input: { | |
indexPage: resolve(__dirname, "index.html"), | |
}, | |
}, | |
}, |
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
yt-dlp "playlist-url" -f "bestvideo[height<=720]+bestaudio/best[height<=720]" --yes-playlist --write-auto-subs --embed-subs --merge-output-format mp4 |
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 EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/ |
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 emojiRef = useRef<HTMLDivElement>(null); | |
useEffect(() => { | |
const handleClickOutside = (event: MouseEvent) => { | |
if (emojiRef.current && !emojiRef.current.contains(event.target as Node)) { | |
// write your outside click function | |
} | |
}; | |
document.addEventListener('click', handleClickOutside, true); | |
return () => { |
NewerOlder