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
function parse(dateToParse) { | |
return chrono.parse(dateToParse) | |
} | |
function parseDate(dateToParse) { | |
return chrono.parseDate(dateToParse) | |
} | |
window = this; |
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 { AnimatePresence, usePresence } from "framer-motion"; | |
import { classNames } from "~/lib/utils/class-names"; | |
import { useCounter } from "@kyleshevlin/use-common"; | |
import { useCallback } from "react"; | |
const Box = ({ count }: { count: number }) => { | |
const [isPresent, safeToRemove] = usePresence(); | |
const onAnimationEnd = useCallback(() => { | |
if (!isPresent) safeToRemove(); |
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
fs.readFile('test.md', {encoding: 'UTF-8'},function (err, data) { | |
if (err) throw err; | |
console.log(data); | |
}); |
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 { useRouteData } from "remix-utils"; | |
import type { SerializeFrom } from "@remix-run/server-runtime"; | |
import type { loader } from "~/root"; | |
export let useRootData = () => | |
useRouteData<SerializeFrom<typeof loader>>("root"); |
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
set -x COMMENT 6272a4 | |
set -x CYAN 8be9fd | |
set -x GREEN 50fa7b | |
set -x ORANGE ffb86c | |
set -x PINK ff79c6 | |
set -x PURPLE bd93f9 | |
set -x RED ff5555 | |
set -x YELLOW f1fa8c | |
set -U fish_color_autosuggestion $COMMENT |
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
" Toggle spellchecking | |
function! ToggleSpellCheck() | |
set spell! | |
if &spell | |
echo "Spellcheck ON" | |
else | |
echo "Spellcheck OFF" | |
endif | |
endfunction |
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
let removeInvalidSearchParams = ( | |
error: unknown, | |
request: Request, | |
prefix = "Unrecognized key(s) in object:" | |
) => { | |
let unrecongnizedKeysSchema = z.tuple([ | |
z.tuple([z.string().length(0), z.string().startsWith(prefix)]), | |
]); | |
let result = unrecongnizedKeysSchema.safeParse(formatError(error)); |
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 type { FetcherWithComponents, FormProps } from "@remix-run/react"; | |
import type { ReactElement, ReactNode } from "react"; | |
import { Form } from "@remix-run/react"; | |
import { useHydrated } from "remix-utils"; | |
export let NoJS = ({ children }: { children: ReactElement }) => { | |
let isHydrated = useHydrated(); | |
if (!isHydrated) { |
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 { | |
createPortal as createReactPortal, | |
unmountComponentAtNode, | |
} from "react-dom"; | |
import { useState, useCallback, useEffect } from "react"; | |
export let usePortal = (el: Element = document.body) => { | |
let [portal, setPortal] = useState<{ | |
render: Function; | |
remove: Function; |
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
function useIsPendingPathname(to) { | |
let { location } = useTransition(); | |
let { pathname } = useResolvedPath(to); | |
return location?.pathname === pathname; | |
} | |
function useIsSlowTransition(ms = 300) { | |
let transition = useTransition(); | |
let [isSlow, setIsSlow] = useState(false); |
NewerOlder