Or: “Everybody likes being given a glass of water.”
By Merlin Mann.
It's only advice for you because it had to be advice for me.
import Anthropic from "@anthropic-ai/sdk"; | |
import type { MessageParam } from "@anthropic-ai/sdk/resources"; | |
import dotenv from "dotenv"; | |
import { Instructor } from "./instructor"; | |
import type { z } from "zod"; | |
dotenv.config(); | |
function sendToClaude<T>(message: MessageParam, schema: z.Schema<T>) { | |
const anthropicClient = new Anthropic({ |
import redis from '@/lib/redis' | |
import { tap } from '@/lib/utils' | |
import { NextResponse } from 'next/server' | |
import { NowPlaying } from '@/types/activities' | |
import { base64_encode, use } from '@/lib/utils' | |
type SpotifyResponse = { | |
is_playing: boolean | |
progress_ms: number | |
item: { |
import type {SanityClient} from '@sanity/client' | |
import {v5 as uuidv5} from 'uuid' | |
import {buildCollectionDocumentId, commitCollectionDocument} from './sanityOps' | |
import type {ShopifyDocumentCollection} from './storageTypes' | |
import {SHOPIFY_COLLECTION_DOCUMENT_TYPE, UUID_NAMESPACE_COLLECTIONS} from './constants' | |
import {DataSinkCollection} from './requestTypes' | |
import {idFromGid} from './requestHelpers' |
import invariant from "tiny-invariant"; | |
class AmalgoBox extends HTMLElement { | |
get input() { | |
return this.querySelector("input") as HTMLInputElement; | |
} | |
get button() { | |
return this.querySelector("button") as HTMLButtonElement; | |
} |
import React, {useEffect, useState, useRef} from 'react' | |
import documentStore from 'part:@sanity/base/datastore/document' | |
import {catchError, distinctUntilChanged} from 'rxjs/operators' | |
import isEqual from 'react-fast-compare' | |
type Params = Record<string, string | number | boolean | string[]> | |
interface ListenQueryOptions { | |
tag?: string | |
apiVersion?: string |
import S from '@sanity/desk-tool/structure-builder' | |
import userStore from 'part:@sanity/base/user' | |
// Get the logged in user | |
const getCurrentUser = () => { | |
userStore.me.subscribe((user) => { | |
// Instead of a local variable, we use this window object to re-use it through the Studio | |
if (user) { | |
window._sanityUser = user ?? undefined | |
} |
async function getComponents(fileKey, token) { | |
// Get file | |
const file = await fetch(`https://api.figma.com/v1/files/${fileKey}`, { | |
headers: { "X-Figma-Token": token } | |
}).then((r) => r.json()) | |
if (file.err === undefined) { | |
// Get style ids | |
const styleIds = Object.keys(file.styles) |
import log from "ololog" | |
class Grid { | |
rows = [] | |
width = 0 | |
height = 0 | |
chars = { | |
active: ["┌", "─", "┒", "┃", "┛", "━", "┕", "│"], | |
inactive: ["┌", "─", "┐", "│", "┘", "─", "└", "│"], |