type ScaleSurveyQuestion = {
id: string;
question: string;
type: 'multiple-choice'
choices: Array<{label: string; answer: string}>;
};
type FreeformSurveyQuestion = {
id: string;
This file contains 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
// ⚠️ warning: This script was written by ChatGPT, not entirely reviewed, and is completely unmodified | |
// This counts your lifetime contributions so you can decide | |
// whether to block Twitter: https://x.com/mjackson/status/1831554887706169674 | |
const GITHUB_API_URL = 'https://api.github.com/graphql' | |
// scope needed: "user:read" for public contributions and "repo" for private | |
// https://github.com/settings/tokens/new | |
const GITHUB_TOKEN = process.env.GITHUB_TOKEN |
This file contains 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 { default: html2canvas } = await import( | |
'https://unpkg.com/html2canvas@1.4.1/dist/html2canvas.esm.js' | |
) | |
async function captureElement(element, { scale = 1, backgroundColor = null } = {}) { | |
const canvas = await html2canvas(element, { | |
backgroundColor, | |
scale, | |
}) | |
This file contains 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
// Name: EpicShop Update | |
// Description: Update the EpicShop workshop app in all the epic web workshop repos | |
// Author: Kent C. Dodds | |
// Twitter: @kentcdodds | |
import '@johnlindquist/kit' | |
import {globby} from 'globby' | |
import {execa} from 'execa' | |
const workshopDirs = [ |
This file contains 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: Twimage Download | |
// Description: Download twitter images and set their exif info based on the tweet metadata | |
// Shortcut: command option control t | |
// Author: Kent C. Dodds | |
// Twitter: @kentcdodds | |
import '@johnlindquist/kit' | |
import fs from 'fs' | |
import {URL} from 'url' | |
import {getTweet} from '../lib/twitter' |
This file contains 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 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 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 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 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, |
NewerOlder