Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@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 October 5, 2023 21:07
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.
@boneskull
boneskull / README.md
Last active January 16, 2024 23:22
workaround for Empyrion workshop subscription limit (bash/shell/WSL)

There are many threads about this, but in a nutshell, the problem is that only a relatively small number of subscriptions can be shown in the blueprint library. I found myself having subscribed to some 700-odd blueprints before I realized this.

The workaround is to just copy the workshop blueprints into the game's blueprints folder. Each workshop blueprint is in its own folder, and only the files in those folders should be copied. But with 700 blueprints, doing this manually is unappealing.

I did this with a Bash script instead. It can be done with a one-liner, but I've split it up a bit to hopefully make it more approachable. Maybe there's an easier way?

Before starting, you'll need to determine:

  • The workshop download directory for Empyrion. On my system this is C:\Program Files (x86)\Steam\steamapps\workshop\content\383120. You may have to do some poking around, since I'm not sure if the number is constant.
  • The blueprint directory. On my system this is `C:\Program Files (x86)\Steam\ste
@boneskull
boneskull / README.md
Last active November 8, 2021 20:07
appium 2 config system technical outline

Appium 2 Configuration System

Appium 2 supports configuration files. A configuration file is intended to have (nearly) 1:1 parity with command-line arguments. An end user can supply Appium 2 with a configuration file, CLI args, or both (the args have precedence over the config file).

This document will be a technical overview of how the configuration system works. It is intended for Appium contributors, but will also explain the system's fundamental features.

Reading a Config File

A config file is a JSON, JavaScript, or YAML file which can be validated against a schema. By default, this file will be named .appiumrc.{json,js,yaml,yml} and should be in the root of the project which depends upon appium. Other filenames and locations are supported via the --config <file> flag. For obvious reasons, the config argument is disallowed within config files.

@boneskull
boneskull / terraria-wld.tcl
Last active March 2, 2020 20:55
HexFiend template for Terraria .wld files
proc tile_entity {} {
set tile_entity_type [uint8]
int32 "ID"
int16 "x"
int16 "y"
if {$tile_entity_type == 0} {
int16 "Target Dummy"
} elseif {$tile_entity_type == 1} {
itemstack ""
} elseif {$tile_entity_type == 2} {
@boneskull
boneskull / nodejs.yml
Created August 13, 2019 23:17
sample node ci/cd config
name: Node CI
on: [push]
jobs:
build:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
@boneskull
boneskull / readme.patch
Created June 27, 2019 04:59
patch file of CPC README.md reformatted with prettier action
From 3ad9624604c21f3b11000cdcdc4034e1cb45b26d Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 27 Jun 2019 04:44:25 +0000
Subject: [PATCH] prettier: lint fix
---
README.md | 64 +++++++++++++++++++++++++++----------------------------
1 file changed, 32 insertions(+), 32 deletions(-)