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
| #!/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/[email protected] CodeHighlight CodeHighlightTests |
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 * 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)}</>; |
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 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; |
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
| "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"), |
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 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>; |
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
| 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}`); |
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 QueryResult = { | |
| nextMeeting?: Meeting; | |
| scheduledMeetings: { | |
| items: Meeting[]; | |
| count: number; | |
| hasMore: boolean; | |
| }; | |
| attendedMeetings: { | |
| items: MeetingFields[]; | |
| count: number; |
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 * as React from 'react'; | |
| enum Async { | |
| START, | |
| SUCCESS, | |
| FAILURE, | |
| } | |
| interface AsyncState<T> { | |
| isLoading: 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
| import type {RefObject} from 'react'; | |
| import {useEffect} from 'react'; | |
| const defer = (fn: () => void) => setTimeout(fn, 0); | |
| export function useCurrentItemScroller(containerRef: RefObject<HTMLElement>) { | |
| useEffect(() => { | |
| const containerEl = containerRef.current; | |
| let observer: MutationObserver | undefined; | |
| if (containerEl) { |
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
| // 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 |
NewerOlder