Skip to content

Instantly share code, notes, and snippets.

View chaotic3quilibrium's full-sized avatar

Jim O'Flaherty chaotic3quilibrium

View GitHub Profile
@chaotic3quilibrium
chaotic3quilibrium / a-prompt.md
Last active April 23, 2026 15:11
The tension between the SRP (Single Responsibility Principle) and DRY (Don't Repeat Yourself Principle)

Given the two software engineering principles, A and B, below the "---"...

  1. What kinds of contexts arise where they are in conflict with wach other?
  2. Wouldn't they more accurately be call a bias or guideline, than a principle?

A. The Single Responsibility Principle (SRP) states that a class or module should have one, and only one, reason to change, meaning it should focus on a single task or actor. As the 'S' in SOLID, it separates concerns to ensure that changes in one business rule do not necessitate changes in others, making code easier to maintain, test, and understand. B. The DRY (Don't Repeat Yourself) principle is a software development guideline stating that "every piece of knowledge must have a single, unambiguous, authoritative representation within a system". It aims to reduce duplication of logic, data, and documentation, ensuring that changes are made in one place to improve maintainability and reduce bugs.

@chaotic3quilibrium
chaotic3quilibrium / App.tsx
Last active April 19, 2026 00:20
LLM TCO Analyzer
import React, { useState, useMemo } from 'react';
import {
Activity,
Server,
Cloud,
Settings,
Info,
BarChart3,
CheckCircle2,
Trophy,
@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.java.utils.StreamUtils.java
Last active May 14, 2025 18:32
A Java utility class providing methods to create Stream instances from various iterable sources
package org.public_domain.java.utils;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.jetbrains.annotations.NotNull;
/**
* File: org.public_domain.java.utils.StreamUtils.java
* <p>
@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.java.utils.Memoizer.java
Last active February 2, 2024 20:16
A Java utility class that caches the resulting value of (expensively?) computing a function taking a single argument
package org.public_domain.java.utils;
import java.util.*;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* File: org.public_domain.java.utils.Memoizer.java
* <p>
@chaotic3quilibrium
chaotic3quilibrium / Overview.txt
Last active October 26, 2023 15:34
Solution to Java Enum Generics Problem Posted on StackOverflow
//StackOverflow Question: https://stackoverflow.com/q/77362860/501113
//Updated/fixed the 5 code files to incorporate the answer by Turing85: https://stackoverflow.com/users/4216641/turing85
@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.java.utils.Either.java
Last active June 20, 2025 21:25
A Java class representing a disjoint-union, i.e. a value of one of two possible types (including reifying the try/catch statement)
package org.public_domain.java.utils;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
@chaotic3quilibrium
chaotic3quilibrium / Effective Scala Case Class Patterns.md
Last active October 6, 2025 07:57
Article: Effective Scala Case Class Patterns - The guide I wished I had read years ago when starting my Scala journey

Effective Scala Case Class Patterns

Version: 2022.03.02

Available As

@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.PurelyFunctionalHangman.scala
Last active January 27, 2021 13:58
An update of John deGoes original PurelyFunctionalHangman to ZIO 1.0
package org.public_domain
import zio.console._
import zio.{ExitCode, UIO, URIO, ZIO}
import java.io.IOException
object PurelyFunctionalHangman extends zio.App {
def run(args: List[String]) : URIO[Console, ExitCode] =
hangman.exitCode
@chaotic3quilibrium
chaotic3quilibrium / Stage01.scala
Created May 5, 2020 20:31
ScalaBoi: Posting a Twitter Thread of Tweets - Stage 1 - Create the Webpage App Backbone
import scalatags.JsDom.all._
val textAreaInput =
textarea.render
val buttonExecuteTransform =
button("Execute Transform").render
val textAreaOutput =
textarea.render
@chaotic3quilibrium
chaotic3quilibrium / TheTenDivisibilities.scala
Created April 24, 2020 15:52
ScalaBoi: A John Conway Puzzler - Part 1 of 2 - Oops, That Didn't Work! Why?!
//C1 - Initial Scala solution attempt
val lettersToDigitsPrefixSize = 3
val letterToDigits =
List(
'a' -> List(1, 3, 7, 9),
'b' -> List(2, 4, 6, 8),
'c' -> List(1, 3, 7, 9),
'd' -> List(2, 4, 6, 8),