type ScaleSurveyQuestion = {
id: string;
question: string;
type: 'multiple-choice'
choices: Array<{label: string; answer: string}>;
};
type FreeformSurveyQuestion = {
id: 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
| import { useSyncExternalStore } from 'react' | |
| /** | |
| * This will call the given callback function whenever the contents of the map | |
| * change. | |
| */ | |
| class ObservableMap extends Map { | |
| constructor(entries) { | |
| super(entries) | |
| this.listeners = new Set() |
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 { useReducer, useRef } from 'react' | |
| import { Switch } from '#shared/switch.tsx' | |
| function callAll<Args extends Array<unknown>>( | |
| ...fns: Array<((...args: Args) => unknown) | undefined> | |
| ) { | |
| return (...args: Args) => fns.forEach(fn => fn?.(...args)) | |
| } | |
| export type ToggleState = { on: 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 'dotenv/config.js' | |
| import chromadb from 'chromadb' | |
| import { RetrievalQAChain } from 'langchain/chains' | |
| import { ChatOpenAI } from 'langchain/chat_models/openai' | |
| import { OpenAIEmbeddings } from 'langchain/embeddings/openai' | |
| import { Chroma } from 'langchain/vectorstores/chroma' | |
| const { OpenAIEmbeddingFunction, ChromaClient } = chromadb | |
| const COLLECTION_NAME = 'test-collection' |
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
| diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/full-stack-testing/exercises__sep__11.finish__sep__01.solution.finished/rbb60w04h7/.env var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/full-stack-testing/exercises__sep__11.finish__sep__01.problem.finished/rbb60w04h7/.env | |
| index d049969..4ac848d 100644 | |
| --- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/full-stack-testing/exercises__sep__11.finish__sep__01.solution.finished/rbb60w04h7/.env | |
| +++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/full-stack-testing/exercises__sep__11.finish__sep__01.problem.finished/rbb60w04h7/.env | |
| @@ -1,2 +1,6 @@ | |
| DATABASE_URL="file:./data.db" | |
| SESSION_SECRET="super-duper-s3cret" | |
| +RESEND_API_KEY="some-secret-key" | |
| +GITHUB_TOKEN="MOCK_abc12392lfkjlsf0" | |
| +GITHUB_CLIENT_ID="MOCK_Iv1.abc12392lfkjlsf0" |
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
| export const sessionKey = 'sessionId' | |
| export const authenticator = new Authenticator<string>(sessionStorage, { | |
| sessionKey, | |
| }) | |
| authenticator.use( | |
| new GitHubStrategy( | |
| { | |
| clientID: process.env.GITHUB_CLIENT_ID, |
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
| diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/data-modeling/exercises__sep__01.init__sep__01.problem.named/39yuovg9r3j/app/root.tsx var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/data-modeling/exercises__sep__09.finished__sep__01.problem/39yuovg9r3j/app/root.tsx | |
| index 7dee21b..6c3aa4b 100644 | |
| --- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/data-modeling/exercises__sep__01.init__sep__01.problem.named/39yuovg9r3j/app/root.tsx | |
| +++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/data-modeling/exercises__sep__09.finished__sep__01.problem/39yuovg9r3j/app/root.tsx | |
| @@ -104,7 +104,6 @@ export const meta: V2_MetaFunction = () => { | |
| { name: 'description', content: `Your own captain's log` }, | |
| ] | |
| } | |
| -// change | |
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
| // Menu: Gather Guest List | |
| // Description: Handle the Guest List for Gather | |
| // Author: Kent C. Dodds | |
| // Twitter: @kentcdodds | |
| import '@johnlindquist/kit' | |
| import {z} from 'zod' | |
| const GuestObjectSchema = z.object({ | |
| name: z.string().optional(), |
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 path from 'node:path' | |
| import assert from 'node:assert' | |
| import * as fs from 'node:fs/promises' | |
| // from scraping: https://www.churchofjesuschrist.org/study/general-conference/speakers/dallin-h-oaks?lang=eng | |
| // with: | |
| /* | |
| function toDate(string) { | |
| const [month, year] = string.split(' ') | |
| return `${year}-${month.includes('Apr') ? '04' : '10'}-30` | |
| } |
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
| // Menu: Optical Character Recognition | |
| // Description: Extract text from images | |
| // Author: Kent C. Dodds | |
| // Twitter: @kentcdodds | |
| import '@johnlindquist/kit' | |
| import Tesseract from 'tesseract.js' | |
| const clipboardImage = await clipboard.readImage() |