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
// npm i @babel/parser @babel/traverse -D | |
const fs = require('node:fs'); | |
const path = require('node:path'); | |
const traverse = require('@babel/traverse').default; | |
const parser = require('@babel/parser'); | |
// Change dir folder |
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
<link href="favicon.png" rel="icon" media="(prefers-color-scheme: light)"> | |
<link href="favicon-dark.png" rel="icon" media="(prefers-color-scheme: dark)"> |
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 { Dispatch, SetStateAction, useCallback, useState } from "react"; | |
/** | |
* Returns a stateful value, its previous value, and a function to update it. | |
*/ | |
export function useStateWithPrev<S>( | |
initialState: S | (() => S), | |
initialPrevState: S | (() => S) | |
): [prevState: S, state: S, setState: Dispatch<SetStateAction<S>>]; | |
// convenience overload when second argument is omitted | |
/** |
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
//@ts-nocheck | |
import { exec } from 'node:child_process'; | |
import fs from 'node:fs'; | |
import inquirer from 'inquirer'; | |
/** | |
* @returns { Promise<string> } | |
*/ | |
const chooseComponentDirectory = async ( |
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
// Rewritten by Cong Nguyen | |
// original code from Facebook Frontend website: https://gist.github.com/ladifire/21fb3e774cf62ac50d0700fd50d1ccb2 | |
import React, { useCallback, useContext, useRef, useState } from "react"; | |
import { PressableGroupContext } from "@facebook-frontend/context"; | |
import { joinClasses, useMergeRefs } from "@facebook-frontend/utils"; | |
import stylex from "@stylexjs/stylex"; | |
import { Pressability } from "./Pressability"; | |
import { useWebPressableTouchStartHandler } from "./useWebPressableTouchStartHandler"; |
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 ProvidersType = [React.ElementType, Record<string, unknown>]; | |
type ChildrenType = { | |
children: Array<React.ElementType>; | |
}; | |
export const buildProvidersTree = ( | |
componentsWithProps: Array<ProvidersType> | |
) => { | |
const initialComponent = ({ children }: ChildrenType) => <>{children}</>; |
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
*, | |
*::before, | |
*::after { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
:where([hidden]:not([hidden='until-found'])) { | |
display: none !important; |
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
md.use( | |
await markdownItShikiji({ | |
highlightLines: false, | |
themes: { | |
light: 'dark-plus', | |
dark: 'dark-plus', | |
}, | |
transformers: [ | |
transformerBracketPairColor({ | |
colors: ['#ffd700', '#da70d6', '#179fff'], |
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 { useEffect, useState } from "react"; | |
interface LocationOptions { | |
enableHighAccuracy?: boolean; | |
timeout?: number; | |
maximumAge?: number; | |
} | |
interface LocationState { | |
coords: { |
NewerOlder