Skip to content

Instantly share code, notes, and snippets.

View goofballLogic's full-sized avatar
👔
Still counting things

Andrew Stewart Gibson goofballLogic

👔
Still counting things
View GitHub Profile
const maybeAdd = (prev, candidate) =>
prev.endsAt <= candidate[1]
? [prev, {
chosen: [...prev.chosen, candidate[0]],
endsAt: candidate[2]
}]
: [prev];
const combine = ts =>
ts.reduce(
const taskListEndsAt = ts =>
Math.max(...ts.map(t => t[2]));
const maybeAdd = (ts, candidate) =>
(taskListEndsAt(ts) <= candidate[1])
? [ts, [...ts, candidate]]
: [ts]
;
const combinations = ts =>
@goofballLogic
goofballLogic / cassidoo.js
Last active November 24, 2025 20:24
Cassidoo Nov 17 2025
function repeatedIntegers_0(n) {
    const ret = []; 
    for(let i = 0; i <= n; i++)
        ret.push(...String(i).repeat(i).split("").map(i => Number(i)));
    return ret;
}
function* repeatedIntegers_1(n) {
    let i = 0;
    while(++i <= n)
// Set up:
// - dotnet new console
// - dotnet add package OneOf
// Implement each of the methods below so that they all compile
// There only one valid implementation for each function (apart from f5 & f6)
using OneOf;
A F1<A>(A a) {
class Cat {
speak() { return "meow"; }
}
function process(cat) {
return cat.speak();
}
class Ball {
}
terraform {
required_version = ">= 0.12"
}
provider "aws" {
region = "eu-west-1"
}
resource "aws_instance" "web" {
const ordinalSuffixes = {
"en": {
"one": "st",
"two": "nd",
"few": "rd",
"other": "th"
}
};
export class OrdinalFormat {
import { OrdinalFormat } from "./ordinal-formatting.js";
const fullFormat = new Intl.DateTimeFormat("en", { dateStyle: "full" });
const now = new Date();
const parts = fullFormat.formatToParts(now);
const weekDayName = parts.find(p => p.type === "weekday").value;
const dayName = parts.find(p => p.type === "day").value;
const fullFormat = new Intl.DateTimeFormat("en", { dateStyle: "full" });
const ordinalSuffixes = {
"one": "st",
"two": "nd",
"few": "rd",
"other": "th"
};
const ordinalPluralRules = new Intl.PluralRules("en", { type: "ordinal" });
const ordinalSuffixes = {
"one": "st",
"two": "nd",
"few": "rd",
"other": "th"
};
const ordinalPluralRules = new Intl.PluralRules("en", { type: "ordinal" });
function withOrdinalSuffix(x) {