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
// pages/api/sponsors.ts | |
import { NextApiRequest, NextApiResponse } from 'next' | |
const AV_SIZE = 32 | |
const PADDING = 4 | |
const COLS = 16 | |
type SponsorResult = { avatarUrl: string; login: 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
// pages/pusher/pusher-auth.ts | |
import { pusher } from "backend/pusher" | |
import { NextApiHandler, NextApiRequest } from "next" | |
interface PushAuthRequest extends NextApiRequest { | |
body: { | |
socket_id: string | |
channel_name: 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
interface BBox { | |
minX: number | |
midX: number | |
maxX: number | |
minY: number | |
midY: number | |
maxY: number | |
width: number | |
height: 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
interface TLBoundsWithCenter { | |
minX: number | |
midX: number | |
maxX: number | |
minY: number | |
midY: number | |
maxY: number | |
width: number | |
height: 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" | |
import { Model } from "@croquet/croquet" | |
import { CroquetContext } from "@croquet/react" | |
/** | |
* A callback that publishes the returned data to the current view's model. | |
* @param eventName The name of the event to be published. | |
* @param fn A function that returns the data to be published. | |
* @param deps (optional) An array of dependencies for the callback. | |
*/ |
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
/* | |
{ | |
"id": "bga2899d28", | |
"label": "Perfect", | |
"icon": "✍︎", | |
"parameters": [ | |
{ | |
"name": "size", | |
"type": "float", | |
"default": "16" |
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 EASINGS: Record<string, (t: number) => number> = { | |
linear: (t) => t, | |
easeInQuad: (t) => t * t, | |
easeOutQuad: (t) => t * (2 - t), | |
easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t), | |
easeInCubic: (t) => t * t * t, | |
easeOutCubic: (t) => --t * t * t + 1, | |
easeInOutCubic: (t) => | |
t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1, |
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 merge from 'deepmerge' | |
import * as idb from 'idb-keyval' | |
import createReact, { UseStore } from 'zustand' | |
import createVanilla, { StoreApi } from 'zustand/vanilla' | |
// Types | |
export type Patch<T> = Partial<{ [P in keyof T]: Patch<T[P]> }> | |
export type Command<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
/** | |
* Get the relative bounds (usually a child) within a transformed bounding box. | |
*/ | |
function getRelativeTransformedBoundingBox( | |
bounds: TLBounds, | |
initialBounds: TLBounds, | |
initialShapeBounds: TLBounds, | |
isFlippedX: boolean, | |
isFlippedY: boolean, | |
): TLBounds { |
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
// pages/api/auth/[...nextAuth].ts | |
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next' | |
import NextAuth from 'next-auth' | |
import Providers from 'next-auth/providers' | |
export default function Auth( | |
req: NextApiRequest, | |
res: NextApiResponse | |
): ReturnType<NextApiHandler> { |