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
#!/usr/bin/env node | |
import { promises as fs } from 'fs' | |
import { homedir } from 'os' | |
import path from 'path' | |
const homeDir = homedir() | |
const dataFilePath = path.join(homeDir, '.epicshop', 'data.json') | |
let data |
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 { Suspense, use, useDeferredValue, useState, useTransition } from 'react' | |
import * as ReactDOM from 'react-dom/client' | |
import { ErrorBoundary } from 'react-error-boundary' | |
import { useSpinDelay } from 'spin-delay' | |
import { getImageUrlForShip, getShip, imgSrc, searchShips } from './utils.tsx' | |
const shipFallbackSrc = '/img/fallback-ship.png' | |
function Shell() { | |
return ( |
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 { Suspense, use, useDeferredValue, useState, useTransition } from 'react' | |
import * as ReactDOM from 'react-dom/client' | |
import { ErrorBoundary } from 'react-error-boundary' | |
import { useSpinDelay } from 'spin-delay' | |
import { getImageUrlForShip, getShip, imgSrc, searchShips } from './utils.tsx' | |
const shipFallbackSrc = '/img/fallback-ship.png' | |
function Shell() { | |
return ( |
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 { | |
Suspense, | |
use, | |
useDeferredValue, | |
useState, | |
useTransition, | |
useEffect, | |
useRef, | |
} from 'react' | |
import * as ReactDOM from 'react-dom/client' |
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/[email protected]/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 } |
NewerOlder