Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@boneskull
boneskull / lodash.template+4.5.0.patch
Created November 19, 2024 21:45
patch for CVE-2021-23337 against [email protected]
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: {
@boneskull
boneskull / index.ts
Created April 9, 2024 04:20
xstate type bug
import { ActorRef, ActorRefFrom, assign, setup } from 'xstate';
type EmittedEvents = {type: 'BAR'};
const machineB = setup({
types: {
input: {} as {
a: ActorRef<any, any, EmittedEvents>
},
},
@boneskull
boneskull / fs-to-volume.mjs
Created March 1, 2024 20:50
create memfs volume from filesystem
#!/usr/bin/env node
/* eslint-disable n/shebang */
// @ts-check
/**
* Prints a `memfs` volume JSON from the filesystem given glob patterns and/or
* directories
*
* Directories are handled recursively
*
@boneskull
boneskull / JS_OVERLOAD.md
Last active October 23, 2023 22:28
TypeScript Function Overloads in PURE JAVASCRIPT!!!!

UPDATE

As of TS v5.0.0, you can use @overload in JSDoc which means this document is obsolete.

How to Overload Functions using TypeScript Types in JavaScript

Summary

Yes, you can. No, it's not pretty.

The Situation

@boneskull
boneskull / nodejs-typescript-compat.md
Last active October 6, 2023 17:32
TypeScript in Node.js: Compatibility Notes

TypeScript in Node.js: Compatibility Notes

I tested some different packages with different TS configurations, and you won't believe what happened next.

Matrix of Failure

The top row of this table lists providers--modules which export type definitions. The left-hand column lists consumers--modules which import type definitions from the providers.

Each consumer header cell will contain three (3) values:

@boneskull
boneskull / README.md
Last active August 4, 2024 20:29
Building Stardew Valley Mods using SMAPI in VS Code

Building Stardew Valley Mods using SMAPI in VS Code

This guide aims to get you setup with Visual Studio Code (as opposed to Visual Studio or MonoDevelop) for developing Stardew Valley mods using SMAPI.

Motivation

Why would you want to use VS Code to mod Stardew? A couple reasons:

  1. You are already familiar with VS Code. You have your preferred extensions, keybindings, themes, etc., already setup.
  2. You prefer a less heavyweight IDE environment.