Skip to content

Instantly share code, notes, and snippets.

View bryophyta's full-sized avatar

Pete F bryophyta

View GitHub Profile
@bryophyta
bryophyta / stack-traces.ts
Created August 19, 2022 16:03
Experiment: Stack traces with TypeScript
// `CallSite` is the class representing a stack frame in the V8 spec
// (see https://v8.dev/docs/stack-trace-api#customizing-stack-traces)
// hat tip to the callsites package, where I'm importing the `CallSite` type from: https://github.com/sindresorhus/callsites
import { CallSite } from "https://raw.githubusercontent.com/sindresorhus/callsites/7fb22a67645ea741cc016937e8f3662eb533eb6e/index.d.ts";
// there is a default implementation for preparing stack traces on the Error object, but TypeScript doesn't recognise
// this. (maybe because it's not present in all runtimes? or maybe the default is initialised in some other way?)
type ErrorWithPrepFn = ErrorConstructor & { prepareStackTrace?: (error: Error, stack: CallSite[]) => unknown}
@bryophyta
bryophyta / coauth.md
Last active December 5, 2023 10:31
git commit coauthor search

Generate co-author messages for git repos

A zsh function which searches through the contributors to the repo in the current working directory, and generates 'co-authored by' messages for them, that can then be copied into your commit messages.

Searches through names and email addresses that have been used in commit messages in the current repo. The -S flag means that searches are 'smart case' by default: case insensitive, unless upper case letters are included in the search string, in which instance it will switch to case sensitive search. Other options can be found in the ripgrep user guide.

Setup

Dependencies

@bryophyta
bryophyta / GHA workflow scraper.md
Last active July 8, 2022 16:31
GHA workflow scraper

README

WIP scripts for scraping and processing Github Actions workflow runs data.

To run from the command line:

deno run --no-check --allow-net=api.github.com --allow-env="GITHUB_TOKEN" --allow-write index.ts [workflow_name]