Skip to content

Instantly share code, notes, and snippets.

View andremw's full-sized avatar
✝️

André Mazoni andremw

✝️
  • Adelaide, Australia
View GitHub Profile
@andremw
andremw / gist:f415a2b4b9b6205bc1139474e6e12088
Created June 17, 2024 07:30
Rescript Validation Applicative - just to avoid losing it
module Validation = {
type t<'s, 'f> =
| Success('s)
| Failure('f)
let pure = v => Success(v)
let apply = (selector, source, combine) =>
switch selector {
| Success(map) =>
@andremw
andremw / typescript.json
Last active June 7, 2022 01:03
My TypeScript snippets for VS Code
{
"Create a nominal type": {
"prefix": "nominal",
"body": "type $1 = Nominal<$0, '$1'>;",
"description": "Creates a nominal type."
},
"Define the base Nominal type": {
"prefix": "basenominal",
"body": [
"class Tagged<T> { #secret_tag: T }",
namespace GameEngine.Common
open System
// SimpleTypes
type String35 = private String35 of string
type PersonName = PersonName of String35
@andremw
andremw / dutchblitz_join-game_workflow_steps.txt
Last active June 30, 2020 00:45
DutchBlitz with F# and DDD - workflow steps
"CheckGameAvailability" =
input: GameId
output: AvailableGameId OR GameAvailabilityError
dependencies: CheckGameExists, CheckGameIsFull
check if the game exists
check if the game hasn't started
check if there's room for one more player
if OK, then:
@andremw
andremw / dutchblitz_join-game_workflow_improved.txt
Last active June 30, 2020 00:19
DutchBlitz with F# and DDD - improved workflow
Bounded Context: Dutch Blitz game
Workflow: "Join Game"
Triggered by:
"Join Game" command
Primary input:
A join request
Output events:
"Player joined game" event
Side-effects:
@andremw
andremw / dutchblitz_join-game_workflow.txt
Last active June 27, 2020 21:14
DutchBlitz with F# and DDD - workflow
Bounded Context: Dutch Blitz game
Workflow: "Join Game"
Triggered by:
"Join Game" command
Primary input:
A join request
Output events:
"Player joined game" event
Side-effects:
@andremw
andremw / dutchblitz_join-game_data.txt
Last active June 18, 2020 15:12
DutchBlitz with F# and DDD - game data
data JoinGameRequest =
PlayerName
AND GameId