From https://github.com/orgs/community/discussions/6874,
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/notifications \
-F read=true From https://github.com/orgs/community/discussions/6874,
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/notifications \
-F read=true | // https://github.com/oxc-project/oxc/blob/a6487482bc053797f7f1a42f5793fafbd9a47114/crates/oxc_codegen/examples/sourcemap.rs#L34-L44 | |
| function generate(code, mapJson) { | |
| const hashRaw = `${code.length}\0${code}${mapJson.length}\0${mapJson}`; | |
| // const hash = btoa(hashRaw); | |
| const hash = Buffer.from(hashRaw, "utf-8").toString("base64"); | |
| return `https://evanw.github.io/source-map-visualization/#` + hash; | |
| } | |
| console.log(generate(result.code, JSON.stringify(result.map))) |
| function wrapConsoleTimeAsync<F extends (...args: any[]) => any>(f: F) { | |
| const wrapper = async function (this: any, ...args: any[]) { | |
| const id = Math.random().toString(36).slice(2).padStart(12, "0"); | |
| const label = `${f.name}:${id}`; | |
| globalThis.console.time(label); | |
| try { | |
| return await f.apply(this, args); | |
| } finally { | |
| globalThis.console.timeEnd(label); | |
| } |
# single test file only on chromium
yarn test:integration -- integration/vite-dev-express-test.ts --headed --project chromium| /* eslint-disable no-console */ | |
| import type { API, FileInfo } from "jscodeshift"; | |
| import * as recast from "recast"; | |
| export default function transformer(file: FileInfo, api: API): string | undefined { | |
| const j = api.jscodeshift; | |
| const $j = j(file.source); | |
| const result: { |
const code = `for (let i = 0; ;i++) { (i++ % 1000000 === 0) && console.log(i); }`
const worker = new Worker(new URL(`data:text/javascript,${encodeURIComponent(code)}`))| // | |
| // generate type-safe react-query options wrapper from a record of async functions | |
| // | |
| type FnRecord = Record<string, (input: unknown) => unknown>; | |
| type FnInput<F extends (input: unknown) => unknown> = Parameters<F>[0]; | |
| type FnOutput<F extends (input: unknown) => unknown> = Awaited<ReturnType<F>>; | |
| type ReactQueryOptionsProxy<T extends FnRecord> = { | |
| [K in keyof T]: { |
Override prefers-color-scheme via CDP
let Main = await import('./entrypoints/main/main.js')
await Main.MainImpl.sendOverProtocol("Emulation.setEmulatedMedia", { features: [{ name: "prefers-color-scheme", value: "dark" }] })| type PropKey = string | number; | |
| type PropValue = null | undefined | number | boolean | string | Date; | |
| export function toPropPathMap(input: unknown) { | |
| const output = new Map<PropKey[], PropValue>(); | |
| function traverse(v: unknown, keys: PropKey[]) { | |
| // prettier-ignore | |
| if ( | |
| typeof v === "undefined" || |