Skip to content

Instantly share code, notes, and snippets.

View regexyl's full-sized avatar

Regina Liu regexyl

View GitHub Profile
@regexyl
regexyl / index.js
Last active January 23, 2024 19:20
Shortcut to render the first page of commits from a public GitHub repo
// Execute this code snippet in the browser console when you're
// already on a repo's webpage. This is pretty helpful when you
// want to read a large OSS project but feel overwhelmed or not
// sure where to start - this is a neat hack to take you to see
// the original core concepts of the project, which might not
// always work but does the job most of the time.
(async () => {
try {
const pathMatches = window.location.pathname.match(/\/([^\/]+\/[^\/]+)(?:\/tree\/([^\/]+))?/);
@regexyl
regexyl / aot-day8.ts
Last active December 9, 2023 09:48
Advent of Typescript 2023
// Filter out key-value pairs in an object that start with 'naughty'
type RemoveNaughtyChildren<T extends {}> = {
[key in keyof T as key extends `naughty_${string}` ? never : key] : T[key]
}
// Test cases
import { Expect, Equal } from 'type-testing';
@regexyl
regexyl / callstack.txt
Created May 19, 2024 06:47
Stack trace for when MarkerType enum from reactflow is imported into Next.js' app/api/trpc router
Server Error
TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
createContext
node_modules/reactflow/dist/umd/index.js (10:49063)
t
node_modules/reactflow/dist/umd/index.js (1:68)
eval
import { Editor, Range } from '@tiptap/core'
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'
import { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view'
import { findSuggestionMatch as defaultFindSuggestionMatch } from './findSuggestionMatch.js'
export interface SuggestionOptions<I = any, TSelected = any> {
/**
* The plugin key for the suggestion plugin.
* @default 'suggestion'