danecando’s gists

#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Usage: spm-install <github-user>/<repo>[@<selector>] [<target>...]
Examples:
spm-install alex-pinkus/tree-sitter-swift CodeHighlight
spm-install alex-pinkus/tree-sitter-swift@0.23.1 CodeHighlight CodeHighlightTests
import * as React from "react";
interface Props<T extends Promise<any>[]> {
promises: T;
children: (results: { [P in keyof T]: Awaited<T[P]> }) => React.ReactNode;
}
export function Awaiter<T extends Promise<any>[]>({ promises, children }: Props<T>) {
const results = React.use(Promise.all(promises));
return <>{children(results)}</>;
type Cond<Args extends any[], TReturn = boolean> = TReturn | ((...args: Args) => TReturn);
interface PolicyActionResult {
permission: boolean;
invariant: Error | undefined;
actionable: boolean;
}
interface PolicyActionFn<Args extends any[] = []> {
(...args: Args): PolicyActionResult;
"use server";
import { redirect } from "next/navigation";
import { z } from "zod";
let signUpSchema = z.object({
email: z.string().min(1, "Email is required").email("Please enter a valid email address"),
displayName: z.string().min(2, "Display name must be at least 2 characters"),
password: z.string().min(6, "Password must be at least 6 characters"),
confirmation: z.string().min(6, "Password confirmation must be at least 6 characters"),
import type { RecordResponse, ListResponse, PaginatedListResponse } from "@pkg/core/api";
import { UserMapper, type UserEntity } from "@pkg/core/user";
export type EntityIdResponse = RecordResponse<{ id: string }>;
/**
* start:users endpoints
*/
export type UserEntityResponse = RecordResponse<UserEntity>;
export type UserEntityListResponse = ListResponse<UserEntity>;
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
type QueryResult = {
nextMeeting?: Meeting;
scheduledMeetings: {
items: Meeting[];
count: number;
hasMore: boolean;
};
attendedMeetings: {
items: MeetingFields[];
count: number;
import * as React from 'react';
enum Async {
START,
SUCCESS,
FAILURE,
}
interface AsyncState<T> {
isLoading: boolean;
// credit @colinhacks
// https://github.com/remix-run/remix/pull/1254
type JSONPrimitives = string | number | boolean | null;
type NonJSONPrimitives = undefined | Function | symbol;
export type SerializeType<T> = T extends JSONPrimitives
? T
: T extends undefined
? undefined