Skip to content

Instantly share code, notes, and snippets.

@joeskeen
joeskeen / distance-between.ts
Last active November 1, 2024 14:13
Calculating distance between two global coordinates (latitude, longitude)
/*
* Based on 'distance-from' NPM package: https://github.com/rickyplouis/distance-from
* refactored to:
* - make the Distance object immutable
* - remove superfluous distance options
* - make types more succinct
* - improve amount of validation for positions
*/
export type Position = [latitude: number, longitude: number];
@joeskeen
joeskeen / name-default-exports.mjs
Created February 12, 2024 16:25
Name the default exports of modules
import { readFileSync, writeFileSync } from "fs";
import glob from "glob";
import { pascalCase } from "change-case";
const defaultExportPattern = /export default \{/;
glob.sync("lib/**/index.js").forEach((file) => {
const fileContents = readFileSync(file, "utf-8").toString();
if (!defaultExportPattern.test(fileContents)) {
return;
@joeskeen
joeskeen / Readme.md
Last active January 2, 2024 05:32
Numbered Coin 3D Model

Numbered Coin 3D Model

image

This SCAD script allows you to print mulitple numbered coin tokens meant to be drawn at random from a bag. There are lines over the top of the number to make it more difficult to feel around for a specific number. To change the number, modify the last line of code to include the desired number. Then take the code to https://ochafik.com/openscad2/ and download it as STL, then slice it with your favorite slicer. It should be able to be printed at any size required, without needing any supports.

@joeskeen
joeskeen / donut.ascii.svg
Last active October 25, 2023 21:30
[wip]donut.ascii.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joeskeen
joeskeen / Readme.md
Last active June 15, 2023 01:56
ng-conf Hackathon 2023

ng-conf Hackathon 2023

image

Welcome to the ng-conf Hackathon 2023! Get ready for an exciting night of coding, innovation, and prizes. Below are the instructions you need to know to make the most out of this event. Let's get started!

Date and Time

  • Date: June 14th 2023
  • Start Time: 8:00 PM MDT
@joeskeen
joeskeen / coin.scad
Created April 20, 2023 19:55
OpenSCAD model for a stackable coin token for games like Puerto Rico, 7 Wonders, etc.
$thickness = 2;
$outerDiameter = 20;
$innerDiameter = $outerDiameter - 2 * $thickness;
$center = true;
module coin($text) {
difference() {
cylinder($thickness, d=$outerDiameter, center=$center);
cylinder($thickness, d=$outerDiameter - $thickness, center=$center);
}
@joeskeen
joeskeen / postinstall-cleanup.ts
Created February 6, 2023 16:58
a script for cleaning up the bloat included in the @pulumi/azure-native package (see https://github.com/pulumi/pulumi-azure-native/issues/1997)
// workaround script to keep TypeScript from crashing in VSCode
// since Pulumi has too big of a package
// run this script after installing NPM packages for infrastructure
// originally created by Ankvi:
// https://github.com/pulumi/pulumi-azure-native/issues/1997#issuecomment-1370835665
import { readdir, rm, writeFile, readFile } from "fs/promises";
import { join } from 'path';
const rootFolder = join(__dirname,'../node_modules/@pulumi/azure-native');
const enumsFolder = join(rootFolder,'types/enums');
@joeskeen
joeskeen / log.txt
Last active February 1, 2023 19:05
BitBucket Pipelines Azure Static Web App Build Failure Log
+ umask 000
+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="main" --depth 50 https://x-token-auth:[email protected]/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...
+ git reset --hard 4c684f2c6785329c62e18489ded3dbaf3f76ac0f
HEAD is now at 4c684f2 fix syntax error
+ git config user.name bitbucket-pipelines
🕊️ 🖼️ 🍇
🖍️🆕isMatch👌
🖍️🆕matchPosition🍬🔢
🖍️🆕matchLength🍬🔢
🆕 🍼isMatch👌 🍼matchPosition🍬🔢 🍼matchLength🍬🔢 🍇🍉
🆕▶️📙 🍇
👎 ➡️ 🖍️isMatch
🤷 ➡️ 🖍️matchPosition
🤷 ➡️ 🖍️matchLength
@joeskeen
joeskeen / Ordering.cs
Created November 22, 2022 18:36
Ordering objects with LINQ
var apples = new[] { new Apple("Red"), new Apple("Blue"), new Apple("Green") };
var oranges = new[] { new Orange(Size.Large), new Orange(Size.Small), new Orange(Size.Medium) };
// works
Console.WriteLine(string.Join(',', apples.OrderBy(x => x)));
// throws InvalidOperationException
Console.WriteLine(string.Join(',', oranges.OrderBy(x => x)));
class Apple : IComparable<Apple>