Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@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).

@mikaelvesavuori
mikaelvesavuori / ic-metrics-gh-graphql-api.md
Last active January 9, 2024 00:57
Get Individual Contributor metrics from GitHub's GraphQL API.

Get Individual Contributor metrics from GitHub's GraphQL API

These are some handy snippets to get common metrics for checking how active a software engineer is.

  • How many pushes are made by the IC?
  • How many reviews are made by the IC?
  • How many comments are made by the IC?

Setup

@phatnguyenuit
phatnguyenuit / how-to-sort-imports-like-a-pro.md
Last active July 3, 2024 21:28
How to sort imports like a pro in TypeScript

How to sort imports like a pro in TypeScript

Crossing reviews becomes a very common activity today in engineering behavior. To help us review changes for pull/merge requests easier, sorting imports can help us a much. The codebase becomes more professional and more consistent, reviewers will be happier, and the review process will be faster, focusing on the implementation changes ONLY.

Have you ever thought about how to sort imports in TypeScript projects automatically?

Let me show you how to archive sorting imports automatically in TypeScript projects with ESLint!

@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active December 19, 2024 00:04
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@Munter
Munter / Typings for unexpected.js.md
Last active May 27, 2024 17:24
Incomplete Typescript types for the unexpected.js assertion library

These are partial typings for the unexpected.js library and some of its dependencies and plugins.

No effort has been made to attempt to type the dynamic nature of the assertions, only the static interfaces have been attempted here

@guybedford
guybedford / mock-loader.mjs
Last active October 23, 2021 23:22
Node.js mocking example
const mocks = Object.create(null);
global.mock = function (_mocks) {
Object.assign(mocks, _mocks);
};
export async function resolve (specifier, context, parentResolve) {
if (mocks[specifier]) {
return { url: 'mock:' + specifier };
}
return parentResolve(specifier, context);
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active December 6, 2024 20:22
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@fnky
fnky / ANSI.md
Last active December 23, 2024 11:01
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

In this tutorial we're going to build a set of parser combinators.

What is a parser combinator?

We'll answer the above question in 2 steps.

  1. What is a parser?
  2. and, what is a parser combinator?

So first question: What is parser?

@othiym23
othiym23 / wtf.md
Last active September 10, 2017 03:35
An experiment. Subject to change.