Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am spareshade on github.
  • I am spareshade (https://keybase.io/spareshade) on keybase.
  • I have a public key ASAjH0r1IZqiO2FZiIsR3Yy_PW1VEQEq9qGS5jmPaUR71go

To claim this, I am signing this object:

@SpareShade
SpareShade / 01 main.go
Last active December 12, 2023 02:29
GetUp - Artwork - Register Editioned Artwork
// Package main is the entry point for the Bleyk App V1.
package main
import (
// Import necessary packages
"context"
"flag"
"fmt"
"log"
@SpareShade
SpareShade / 01 - artwork caption aggregate.go
Last active December 12, 2023 01:41
GetUp - Event Sourcing
// Package caption provides the implementation of the CaptionAggregate, an aggregate representing the state
// of captions for artworks within the artwork domain. This package handles the registration, modification,
// and tracking of caption details for both unique and editioned artworks. The CaptionAggregate ensures data
// integrity by applying events in a specific order and emitting new events for changes in caption details.
// It also includes functions for transitioning the aggregate state, tracking changes, and handling various
// commands related to caption management.
//
// The CaptionAggregate is designed to work within a larger context of an artwork service, where it interacts
// with other components to maintain a consistent and reliable state of artwork captions. The code includes
// comments and documentation to guide developers through the functionality and usage of the CaptionAggregate.
@SpareShade
SpareShade / allLoopsBack.ts
Created December 12, 2023 01:46
GetUp - Loops
type Edge = [number, number];
function allLoopsBack(node: number, edges: Edge[]): number[][] {
const loops: number[][] = [];
const visited: boolean[] = new Array(edges.length).fill(false);
function findPaths(inNode: number, path: number[]): void {
const inNodeIdx = edges.findIndex((e) => e[0] === inNode);
// must exist as an `in` node