Skip to content

Instantly share code, notes, and snippets.

@foolmoron
foolmoron / typescript.ts
Last active November 17, 2022 18:36
Advanced Typescript Types companion code
// To follow along using VSCode, copy/paste this code into
// a TS file (using TS 4.8.2+), and enable the VSCode
// js/ts.implicitProjectConfig.strictNullChecks setting
const obj = {
nested: {
prop1: 1,
prop2: 'a',
}
@foolmoron
foolmoron / compression.js
Last active July 27, 2021 22:47
Node.js compression tests
const zlib = require('zlib');
const perf_hooks = require('perf_hooks')
function t() {
return perf_hooks.performance.now()
}
const BUFFER_SIZE = 1024*1024
const TRIALS = 20
@foolmoron
foolmoron / ListDict.cs
Last active March 1, 2022 06:08
C# List-backed dictionary, for garbage-free and consistent performance
public class ListDict<TKey, TValue> {
public readonly List<TKey> Keys;
public readonly List<TValue> Values;
public int Count { get { return Keys.Count; } }
public ListDict(int capacity = 0) {
Keys = new List<TKey>(capacity);
Values = new List<TValue>(capacity);
}
@foolmoron
foolmoron / autoSkip.js
Last active August 5, 2016 20:01
Auto skip certain songs on Soundcloud by title
function autoSkip(songName) {
setInterval(() => {
if (document.querySelector('.sound.playing .soundTitle__title').innerText.toLowerCase().indexOf(songName.toLowerCase()) >= 0) {
document.querySelector('.skipControl__next').click();
}
}, 500);
}
autoSkip('Cold Water'); // seriously plz stop remixing this
@foolmoron
foolmoron / keybase.md
Created May 8, 2015 03:29
Keybase.io identity verification!

Keybase proof

I hereby claim:

  • I am foolmoron on github.
  • I am foolmoron (https://keybase.io/foolmoron) on keybase.
  • I have a public key whose fingerprint is D39F 27DE E6F2 B60F FA59 14DD 6A8F 8CA1 9B7D 7064

To claim this, I am signing this object: