Skip to content

Instantly share code, notes, and snippets.

View lewxdev's full-sized avatar
:shipit:

J. Lewis lewxdev

:shipit:
View GitHub Profile
{
"type": "object",
"additionalProperties": false,
"required": ["patches"],
"properties": {
"patches": {
// PatchSet
// see: https://github.com/itzg/mc-image-helper#patchset
"type": "array",
"additionalItems": false,
export const batchAsync = async function <T>(
iterable: Iterable<T> | AsyncIterable<T>,
callback: (value: T) => Promise<void>,
limit: number,
) {
const batch = new Set<Promise<void>>();
for await (const value of iterable) {
const promise = callback(value).finally(() => {
batch.delete(promise);

git commands

what I've picked up over the years about the stupid content tracker

🚽 porcelain

git clean -dfx [<path>...]

@lewxdev
lewxdev / deploy-github-pages-vite-react.md
Last active July 11, 2024 18:05
script for a static vite / react app github pages deployment

GitHub Pages deployment for a Vite / React app

⚠️ EDIT After testing this solution again, it looks like it only worked the first time. Additional research might help produce and actually viable solution

A better solution may be deployment via GitHub Actions, but I stumbled upon a working solution someone else may find helpful. It modifies the shell script found in the documentation a bit to use a workspace to support history

@lewxdev
lewxdev / shorthand-formatted-regex.js
Last active July 11, 2024 18:03
a utility function `$p()` that creates regular expression patterns from shorthand
/**
* Produces an array of locale-respective formats
* @template {keyof Intl.DateTimeFormatOptions} K
* @template {(NonNullable<Intl.DateTimeFormatOptions[K]>)[]} [F=["long", "short"]]
* @param {K} key - a valid key on the `Intl.DateTimeFormatOptions` object
* @param {number} quantity - the number of units of the provided option
* @param {(index: number) => Date} callback - used for creating subsequent dates
* @param {F} formats - an optional list of formats to generate and key
* @returns {{ [format in F[number]]: string }[]}
*/