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
// vercel.json | |
{ | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "package.json", | |
"use": "@vercel/static-build", | |
"config": { | |
"distDir": "public" |
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 { Prisma } from '@prisma/client'; | |
type IPrismaStringFilter< | |
Prefix extends string, | |
Delimiter extends string = '_', | |
Operations extends keyof Prisma.StringFilter = keyof Prisma.StringFilter, | |
> = { | |
[K in `${Prefix}${Delimiter}${keyof Pick< | |
Prisma.StringFilter, | |
Extract<'equals' | 'contains' | 'startsWith' | 'endsWith', Operations> |
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 { Prisma } from '@prisma/client'; | |
type IPrismaIntFilter< | |
Prefix extends string, | |
Delimiter extends string = '_', | |
Operations extends keyof Prisma.IntFilter = keyof Prisma.IntFilter, | |
> = { | |
[K in `${Prefix}${Delimiter}${keyof Pick< | |
Prisma.IntFilter, | |
Extract<'equals' | 'gt' | 'gte' | 'lt' | 'lte' | 'not', Operations> |
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 { Prisma } from '@prisma/client'; | |
type IPrismaDateTimeFilter< | |
Prefix extends string, | |
Delimiter extends string = '_', | |
Operations extends keyof Prisma.DateTimeFilter = keyof Prisma.DateTimeFilter, | |
> = { | |
[K in `${Prefix}${Delimiter}${keyof Pick< | |
Prisma.IntFilter, | |
Extract<'equals' | 'gt' | 'gte' | 'lt' | 'lte' | 'not', Operations> |
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 { ApiProperty } from '@nestjs/swagger'; | |
import { IsEnum, IsOptional } from 'class-validator'; | |
import { Prisma } from '@prisma/client'; | |
const orderByKeys = [ | |
'id', | |
'title', | |
'content', | |
'createdAt', |
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 { cleanEnv, url } from "envalid"; | |
// We have to do this because of how Next.JS handles process.env | |
const processEnv = { | |
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, | |
}; | |
const env = cleanEnv(processEnv, { | |
NEXT_PUBLIC_API_URL: url(), | |
}); |
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
If you have a React component with compount components e.g. List, List.Item using HOC will remove compound components. | |
For the HOC to inherit compound components you need to do it manually. | |
Use a library like: https://www.npmjs.com/package/hoist-non-react-statics |
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
// This problem occurs when using reactjs-social-login with a SSR metaframework. | |
// The solution below is for Next.JS. Your framework may do dynamic imports differently. | |
const LoginSocialInstagram = dynamic( | |
() => import('reactjs-social-login').then((lib) => lib.LoginSocialInstagram), | |
{ ssr: false } | |
); |
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
/* | |
This is the solution to the following error: | |
Property 'em-emoji' does not exist on type 'JSX.IntrinsicElements'.ts(2339) | |
*/ | |
// Define em-emoji web component inside React | |
// https://github.com/missive/emoji-mart#-emoji-component | |
interface EmEmojiProps { | |
id?: string | |
shortcodes?: string |
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
// https://ihateregex.io/expr/emoji/ | |
export const emojiRegExpString = | |
'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])' | |
export const emojiToUnified = (emoji: string) => | |
[...emoji].map((e) => e.codePointAt(0)?.toString(16)).join('-') | |
export const unifiedRegExpString = '\b([da-fA-F]{4,5}|[da-fA-F]{6}|[da-fA-F]{8})\b' | |
export const unifiedToEmoji = (unified: string) => |
NewerOlder