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
/** | |
* @template {keyof HTMLElementTagNameMap} T | |
* @param {any} el | |
* @param {T} elName | |
* @returns {el is HTMLElementTagNameMap[T]} | |
*/ | |
function isElement(el, elName) { | |
return el?.constructor?.name === elName; | |
} |
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
-- usage: osascript type.scpt <file> | |
on run {filePath} | |
set posixFilePath to filePath | |
set fileContent to do shell script "cat " & quoted form of posixFilePath | |
log "Will start typing in 3 seconds..." | |
delay 3 | |
tell application "System Events" | |
set initialAppName to name of first application process whose frontmost is true | |
beep 1 | |
log "Typing into: " & initialAppName |
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
$ cat Cargo.toml | |
[package] | |
name = "rustdepstest" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
swc = "0.264.38" | |
$ cargo tree |
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
# /etc/wmbusmeters.d/ColdWater | |
name=ColdWater | |
# the id printed on the meter | |
id=030xxxxx | |
key=NOKEY | |
driver=hydrodigit |
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
/** | |
* Terminating link that directly calls the tRPC router | |
*/ | |
export function createTestLink<TRouter extends AnyRouter>(opts: { | |
headers: () => Promise<Record<string, string>>; | |
router: TRouter; | |
}): TRPCLink<TRouter> { | |
return () => { | |
return (runtime) => { | |
return observable((observer) => { |
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
FROM node:14-slim | |
ENV NODE_ENV=production | |
COPY pnpm-deploy-output /app | |
WORKDIR /app | |
ENTRYPOINT ["/app/entrypoint.sh"] |
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 getScrollContainer(node: HTMLElement | null): HTMLElement | null { | |
if (!node) { | |
return null; | |
} | |
if (node.scrollHeight > node.clientHeight) { | |
if (node === document.body) { | |
return document.documentElement; | |
} | |
return node; |
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
interface ViewProps<T> { | |
as?: T; | |
ref?: React.Ref< | |
T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : T | |
>; | |
children?: React.ReactNode; | |
} | |
declare function ViewType<T extends ElementType = "div">( | |
props: React.ComponentPropsWithoutRef<T> & ViewProps<T>, |
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
/** | |
* Render a div which preserves its server-side content on browser hydration. | |
*/ | |
function NoHydrate(props: { id?: string; children: React.ReactNode }) { | |
const id = props.id ?? "no-hydrate"; | |
const container = useRef<HTMLDivElement>(null); | |
const save = useRef<Node[]>(); | |
// During the first render capture clones of the children. Reading the DOM | |
// during React render is a hack but the only way to access the DOM before |
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 { json } from "@remix-run/node"; | |
import { useActionData, useLoaderData } from "@remix-run/react"; | |
export function useTypedLoaderData<T extends (arg: any) => any>(): Awaited< | |
ReturnType<T> | |
> { | |
return useLoaderData(); | |
} | |
export function useTypedActionData<T extends (arg: any) => any>(): |
NewerOlder