Skip to content

Instantly share code, notes, and snippets.

View kentcdodds's full-sized avatar
🤓
working hard to make the world better with software

Kent C. Dodds kentcdodds

🤓
working hard to make the world better with software
View GitHub Profile
@kentcdodds
kentcdodds / notes.md
Created October 17, 2023 03:10
Survey notes
type ScaleSurveyQuestion = {
  id: string;
  question: string;
  type: 'multiple-choice'
  choices: Array<{label: string; answer: string}>;
};

type FreeformSurveyQuestion = {
  id: string;
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'
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"
export const sessionKey = 'sessionId'
export const authenticator = new Authenticator<string>(sessionStorage, {
sessionKey,
})
authenticator.use(
new GitHubStrategy(
{
clientID: process.env.GITHUB_CLIENT_ID,
@kentcdodds
kentcdodds / diff.patch
Last active July 19, 2023 17:47
Big git diff
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
// 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(),
@kentcdodds
kentcdodds / update-id3.mp3.js
Last active June 25, 2023 22:42
Update mp3 ID3 tags for general conference talks
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`
}
// 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()
// 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()
// 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()