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
| #!/bin/bash | |
| # Ensure we're working on the latest version of the main branch | |
| git switch main | |
| git fetch | |
| git pull | |
| # Create a new branch | |
| git switch -c vitest |
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
| .pnp.* | |
| .yarn/* | |
| !.yarn/patches | |
| !.yarn/plugins | |
| !.yarn/releases | |
| !.yarn/sdks | |
| !.yarn/versions |
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
| # Find | |
| import\s(([^;]|\n)*)\sfrom\s(['"])(\.{1,2}\/.*)(?<!\.js)(?<!\.(css|pdf|png|jpg|jsx|mjs|mp3|mp4|svg|ttf))(?<!\.(avif|json|webm|webp|woff))(?<!\.woff2)(['"]); | |
| # Replace with | |
| import $1 from $3$4.js$7; |
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 findScrollContainer = (element) => { | |
| if (!element) { | |
| return undefined; | |
| } | |
| let parent = element.parentElement; | |
| while (parent) { | |
| const { overflow } = window.getComputedStyle(parent); | |
| if (overflow.split(' ').every(o => o === 'auto' || o === 'scroll')) { | |
| return parent; |
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
| /** | |
| * Allows to use multiple refs on a single React element. | |
| * Supports both functions and ref objects created using createRef() and useRef(). | |
| * | |
| * Usage: | |
| * ```jsx | |
| * <div ref={mergeRefs(ref1, ref2, ref3)} /> | |
| * ``` | |
| * | |
| * @param {...Array<Function|Object>} inputRefs Array of refs |
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
| { | |
| // Enables breadcrumbs | |
| "breadcrumbs.enabled": true, | |
| // Slightly improves performance if you don't usescreen reader | |
| "editor.accessibilitySupport": "off", | |
| // My favorite font settings | |
| "editor.fontFamily": "'Fira Code', monospace", | |
| "editor.fontLigatures": true, |
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 assert from 'node:assert'; | |
| import path from 'node:path'; | |
| async function esmOrCjs(filepath) { | |
| const absolutePath = import.meta.resolve(filepath).replace('file://', ''); | |
| const ext = path.extname(absolutePath); | |
| switch (ext) { | |
| case '.mjs': | |
| return 'esm'; |
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
| #!/bin/bash | |
| # Ensure we're working on the latest version of the main branch | |
| git switch main | |
| git fetch | |
| git pull | |
| # Create a new branch | |
| git switch -c vite |
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
| /// <reference types="react/next" /> | |
| import { use as originalUse, useContext } from 'react'; | |
| const STATUS = { | |
| PENDING: 'pending', | |
| REJECTED: 'rejected', | |
| FULFILLED: 'fulfilled', | |
| } as const; | |
| type TState<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 pattern = /https?:\/\/[^\s]*/g; | |
| function formatLink(url, props) { | |
| if (!url) { | |
| return ''; | |
| } | |
| let host; | |
| let pathname; |
NewerOlder