Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@boneskull
boneskull / require-intrinsic-destructuring.mjs
Created September 24, 2025 05:17
ESLint rule to disallow direct use of static methods on intrinsics
/**
* ESLint rule to require static methods of intrinsics to be dereferenced before
* use
*
* This rule enforces that static methods of JavaScript intrinsics (like
* Object.keys, Array.from, etc.) should be destructured before use instead of
* being accessed directly. This can help with performance and bundle size by
* allowing these methods to be reused throughout a module.
*
* @example
@boneskull
boneskull / require-function-tag-in-arrow-functions.mjs
Last active September 24, 2025 04:54
ESLint rule to require @function in docstring of arrow function expressions
/**
* ESLint rule to require `@function` tag in JSDoc comments for arrow functions
*
* @packageDocumentation
*/
import {
AST_NODE_TYPES,
AST_TOKEN_TYPES,
ESLintUtils,
@boneskull
boneskull / README.md
Last active June 5, 2025 23:20
git: cleanup remote & local rebased branches (zsh)

git-cleanup

A Zsh script to clean up local and remote Git branches that have already been rebased (fully merged) onto a target branch.

Depends on branch name prefixes; for example, feature/, bugfix/, etc. I tend to use my username boneskull.

Features

  • Deletes local branches matching a prefix that have been rebased onto a target branch.
  • Deletes remote branches matching a prefix that have been rebased onto a target branch.
@boneskull
boneskull / README.md
Created June 3, 2025 22:40
oh-my-zsh: open manpages in Dash.app (macOS Sequoia)

This is a snippet for zsh you can add to a .zshrc to automatically open manpages in Dash if and only if the "Manpages" DocSet is installed. It's been tested with macOS Sequoia (v15.5).

It uses the omz_urlencode function provided by oh-my-zsh.

If you don't have oh-my-zsh installed, you can paste this into your .zshrc as a reasonable substitution:

omz_urlencode() {
  local string="${@}"
 local strlen=${#string}
@boneskull
boneskull / uninstall-foreign-fonts.sh
Created May 7, 2025 19:22 — forked from jm3/uninstall-foreign-fonts.sh
uninstall the 162 non-English fonts that Apple installs that clog up Photoshop's font menu.
#!/bin/sh
# jm3.net
# uninstall the 162 non-English fonts that Apple installs that clog up Photoshop's font menu.
# ========================
## RUN AT YOUR OWN RISK ##
# ========================
# if this formats your hard drive or deletes your fonts or changes the sex
# of your dog, I'm super sorry, but there's nothing I can do.
@boneskull
boneskull / lodash.template+4.5.0.patch
Created November 19, 2024 21:45
patch for CVE-2021-23337 against lodash.template@4.5.0
diff --git a/node_modules/lodash.template/index.js b/node_modules/lodash.template/index.js
index f051141..c4cb7e1 100644
--- a/node_modules/lodash.template/index.js
+++ b/node_modules/lodash.template/index.js
@@ -1519,9 +1519,29 @@ function template(string, options, guard) {
// Like with sourceURL, we take care to not check the option's prototype,
// as this configuration is a code injection vector.
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
+
+ var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
diff --git a/node_modules/lodash.template/index.js b/node_modules/lodash.template/index.js
index f051141..c4cb7e1 100644
--- a/node_modules/lodash.template/index.js
+++ b/node_modules/lodash.template/index.js
@@ -1519,9 +1519,29 @@ function template(string, options, guard) {
// Like with sourceURL, we take care to not check the option's prototype,
// as this configuration is a code injection vector.
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
+
+ var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
diff --git a/node_modules/lodash.template/index.js b/node_modules/lodash.template/index.js
index f051141..c4cb7e1 100644
--- a/node_modules/lodash.template/index.js
+++ b/node_modules/lodash.template/index.js
@@ -1519,9 +1519,29 @@ function template(string, options, guard) {
// Like with sourceURL, we take care to not check the option's prototype,
// as this configuration is a code injection vector.
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
+
+ var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
@boneskull
boneskull / README.md
Last active August 28, 2024 21:25
Test helpers for xstate & Node.js

This code contains some helper functions for testing xstate v5+ Actor and Machine behavior using Promises and "traditional" assertions (vs state-machine-based testing).

Maybe I'll put some examples here.


Update Aug 28 2024

Instead of this, see xstate-audition which I built upon this idea (with less OOP).

// @ts-check
'use strict';
/**
* @returns {import('wallabyjs').IWallabyConfig}
*/
module.exports = (wallaby) => {
return {
env: {