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
{ | |
"tailwindCSS.experimental.classRegex": [ | |
"[cC]lass\\: '([^']*)'", | |
"[cC]lassName\\: '([^']*)'", | |
"tw`([^`]*)" | |
] | |
} |
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 { verifyRequestOrigin } from 'lucia' | |
import { NextResponse } from 'next/server' | |
type RouteHandler = (request: Request) => NextResponse | Response | |
// Wrap your Next.js Route Handler with this middleware to protect against CSRF attacks | |
// NOTE: this won't protect against CSRF attacks on Server Actions and Server Components, | |
// so it's better to configure this in middleware.ts | |
export function csrfGuard(guardedFn: RouteHandler): RouteHandler { | |
return (request: Request, ...context) => { |
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
#!/bin/bash | |
set -e | |
# Load .env file | |
if [ -f .env ]; then | |
export $(cat .env | sed 's/#.*//g' | xargs) | |
else | |
echo "No .env file found" | |
exit 1 |
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
'use client' | |
import { useEffect } from 'react' | |
export function ServiceWorkers(): JSX.Element { | |
useEffect(() => { | |
if (typeof window === 'undefined') { | |
return | |
} | |
if ('serviceWorker' in navigator) { |
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 N_SESSION_NODE_VERSION=18 | |
# Then, in your PHPStorm or Webstorm project settings you can configure the | |
# Terminal to override this value via N_SESSION_NODE_VERSION_OVERRIDE, e.g.: | |
# N_SESSION_NODE_VERSION_OVERRIDE=16 | |
# |
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 React from 'react' | |
type PolymorphicPropsFactory<T, P> = { | |
as?: T | React.ElementType | |
children?: React.ReactNode | undefined | |
className?: string | undefined | |
} & React.RefAttributes<T> & | |
P | |
export type PolymorphicProps<T, FallbackPropsType> = |
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 React from 'react' | |
type PolymorphicPropsFactory<T, P> = { | |
as?: T | React.ElementType | |
children?: React.ReactNode | undefined | |
} & React.RefAttributes<T> & | |
P | |
type PolymorphicProps<T, FallbackPropsType> = | |
// as = Function Component |
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
// Copy the following line of code, and paste it prefixed with "javascript:" (without the quotes), in a browser bookmark | |
function h(html) { return html.replace(/<p>/g, '\n\n').replace(/<\/p>/g, '').replace(/<b>/g, '**').replace(/<\/b>/g, '**').replace(/<i>/g, '_').replace(/<\/i>/g, '_').replace(/<code[^>]*>/g, (match) => { const lm = match.match(/class="[^"]*language-([^"]*)"/); return lm ? %27\n```%27 + lm[1] + %27\n%27 : %27```%27; }).replace(/<\/code[^>]*>/g, %27```%27).replace(/<[^>]*>/g, %27%27).replace(/Copy code/g, %27%27).replace(/This content may violate our content policy. If you believe this to be in error, please submit your feedback — your input will aid our research in this area./g, %27%27).trim(); } (()=>{ const e=document.querySelectorAll(".text-base");let t="";for(const s of e)s.querySelector(".whitespace-pre-wrap")&&(t+=`**${s.querySelector(%27img%27)?%27You%27:%27ChatGPT%27}**: \n${h(s.querySelector(".whitespace-pre-wrap").innerHTML)}\n\n`);const o=document.createElement("a");o.download=wi |
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 React, { useEffect } from 'react' | |
type StyledFC = React.FC<{ children?: React.ReactNode }> | |
type StyledModule = <T extends string[]>( | |
...classNames: T | |
) => { | |
Styled: StyledFC | |
classMap: Record<T[number], 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://docs.google.com/presentation/d/1oqR-9VwK1fSFriMKneYnr2RUTo-jTmsbmwOi1ayrMp0/edit?usp=sharing |
NewerOlder