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 { writeFile, mkdir } from "fs/promises"; | |
import { join } from "path"; | |
import PQueue from "p-queue"; | |
import ora from "ora"; | |
import chalk from "chalk"; | |
// Add these type declarations at the top | |
declare module "fs/promises"; | |
declare module "path"; | |
declare global { |
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
function extractIssues() { | |
const issues = []; | |
const rows = document.querySelectorAll('[data-test-id="group"]'); | |
rows.forEach(row => { | |
const issue = { | |
id: row.getAttribute('data-group-id'), | |
title: row.querySelector('[data-sentry-component="EventOrGroupTitle"]').textContent.trim(), | |
status: row.querySelector('[data-sentry-element="GraphText"]').textContent.trim(), | |
lastSeen: row.querySelector('time').getAttribute('datetime'), |
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 Anthropic from "@anthropic-ai/sdk"; | |
import type { MessageParam } from "@anthropic-ai/sdk/resources"; | |
import dotenv from "dotenv"; | |
import { Instructor } from "./instructor"; | |
import type { z } from "zod"; | |
dotenv.config(); | |
function sendToClaude<T>(message: MessageParam, schema: z.Schema<T>) { | |
const anthropicClient = new Anthropic({ |
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
<? | |
# MIT license, do whatever you want with it | |
# | |
# This is my invoice.php page which I use to make invoices that customers want, | |
# with their address on it and which are easily printable. I love Stripe but | |
# their invoices and receipts were too wild for my customers on Remote OK | |
# | |
require_once(__DIR__.'/../vendor/autoload.php'); |
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 { GetServerSideProps } from "next"; | |
import Head from "next/head"; | |
import { useEffect, useRef, useState } from "react"; | |
// I suggest to create a read-only Stripe key with access to invoices + customers for this) | |
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY_INVOICE_GENERATOR); | |
export default function InvoicePage(props) { | |
const invoice = props.invoice; |
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
addEventListener("fetch", event => { | |
event.respondWith(handle(event.request)) | |
}) | |
async function handle(request) { | |
// Fetch from origin server. | |
let response = await fetch(request) | |
// Make sure we only modify text, not images. | |
let type = response.headers.get("Content-Type") || "" |
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 | |
const isNpx = process.argv.some((segment) => segment.includes('_npx') || segment.includes('npx')) | |
console.log('yay gist'); | |
console.log(process.argv, process.argv0); | |
console.log(`${isNpx ? 'likely npx' : 'not likely to be npx'}`) | |
console.log(process.env) | |
console.log(['env._ ends with npx', process.env._.endsWith('/npx')]) |
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 type { Context } from "netlify:edge"; | |
import { | |
Cookie, | |
setCookie, | |
} from "https://deno.land/[email protected]/http/cookie.ts"; | |
import { CookieJar } from "https://deno.land/x/cookies/mod.ts"; | |
let bots = [ | |
// generic | |
'bot', // googlebot, bingbot, telegrambot, twitterbot, yandexbot, etc. |
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 React, { | |
useEffect, useState | |
} from 'react' | |
import DefaultPane from '@sanity/components/lib/panes/DefaultPane' | |
import client from 'part:@sanity/base/client' | |
const CustomPane = (props) => { | |
const [groups, setGroups] = useState([]) | |
useEffect(() => { |
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 * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
NewerOlder