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 { Err, Ok, PromiseResult } from 'path/to/module'; | |
interface User { | |
// ... | |
} | |
enum UserError { | |
USER_NOT_FOUND = 'USER_NOT_FOUND', | |
} |
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 { z } from 'zod'; | |
function transformFileProperty<T extends string>(key: T) { | |
return (data: Record<string, string>) => { | |
if (data[key]) { | |
return { | |
[key]: data[key], | |
} as { | |
[P in T]: string; | |
}; |
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
preload = ['./path/to/plugin.ts'] |
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
latency() { | |
# Check if URL is provided | |
if [[ -z "$1" ]]; then | |
echo "Error: URL is required" | |
echo "Usage: latency <url> [number_of_requests]" | |
return 1 | |
fi | |
local url="$1" | |
local times=${2:-10} |
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
#cloud-config | |
# Variables: | |
# - `ssh_authorized_keys`: A YAML encoded list of SSH public keys to add to the user's `authorized_keys` file | |
# - `timezone`: The timezone to set the system to | |
# - `username`: The username of the user to create | |
disable_root: true | |
manage_resolv_conf: true | |
package_reboot_if_required: 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 { existsSync } from "@std/fs/exists"; | |
interface LoadOptions { | |
/** | |
* Whether to overwrite existing env vars. | |
* | |
* @default false | |
*/ | |
overwrite?: boolean; | |
/** |
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 ChuckNorrisFact = z.object({ | |
icon_url: z.string().url(), | |
id: z.string().min(1), | |
url: z.string(), | |
value: z.string(), | |
}); | |
const UserOptions = z | |
.object({ | |
category: z.enum([ |
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 { AstroError } from "astro/errors"; | |
import { z } from "astro/zod"; | |
import type { Loader, LoaderContext } from "astro/loaders"; | |
interface CustomLoader<T extends z.ZodTypeAny> extends Omit<Loader, "load"> { | |
load: (ctx: LoaderContext, options: z.infer<T>) => ReturnType<Loader["load"]>; | |
options?: 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
type Prettify<T> = | |
& { [K in keyof T]: T[K] } | |
& {}; | |
type KvConsistencyOptions = Parameters<Deno.Kv['get']>[1]; | |
interface MapTypedKv<K extends string, V extends unknown> { | |
delete(id: K): Promise<void>; | |
get(id: K, options?: KvConsistencyOptions): Promise<Deno.KvEntryMaybe<V>>; | |
getMany<T extends readonly unknown[]>( |
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
type ByteFormatStr = "b" | "gb" | "kb" | "mb" | "pb" | "tb"; | |
type ByteSize = `${number}${ByteFormatStr}`; | |
interface NextApiConfig { | |
api?: { | |
bodyParser?: | |
| false | |
| { | |
sizeLimit: ByteSize; | |
}; |
NewerOlder