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
#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 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 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 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 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 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; | |
}; |
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
/** | |
* Creates a promise that is resolved with a disctionary of results when all of the provided Promises | |
* resolve, or rejected when any Promise is rejected. | |
* | |
* This function is derived from the standard `Promise.all` function, but it works with a dictionary | |
* of promises instead of an array. | |
* | |
* @param values A dictionary of Promises. | |
* | |
* @example |
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 ReactNode } from 'react'; | |
interface NextHeadProps { | |
params?: Record<string, string | number | boolean>; | |
} | |
interface HeadProps { | |
description?: string; | |
title?: string; | |
titleTemplate?: `%s${string}`; |
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
type GenerateStaticParamsFn<TParams extends Array<unknown>> = () => TParams | Promise<TParams>; | |
type ArrayElement<A> = A extends ReadonlyArray<infer T> ? T : never; | |
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T; | |
interface NextPageProps< | |
TGenerateStaticParams extends GenerateStaticParamsFn<TParams> | undefined = undefined, | |
TParams extends Array<unknown> = Array<unknown>, | |
> { |
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 flipEntries <TValue = unknown> (obj: Record<string, TValue>) { | |
return Object.fromEntries(Object.entries(obj).map(([key, value]) => Array.isArray(value) ? [...value.map((v) => [v, key])] : [[value, key]]).flat()) | |
} |
NewerOlder