Skip to content

Instantly share code, notes, and snippets.

View wallymathieu's full-sized avatar

Oskar Mathieu Gewalli wallymathieu

View GitHub Profile
@endofcake
endofcake / Dockerfile
Last active October 23, 2024 06:24
Copy *.csproj files during a docker build, preserving the directory structure (kudos to @aidansteele)
COPY src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done
@swlaschin
swlaschin / effective-fsharp.md
Last active March 28, 2026 22:41
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@ecampidoglio
ecampidoglio / git-cpr-alias.md
Created October 30, 2019 12:19
Checkout Pull Request

Checkout Pull Request

A Git alias to quickly check out a Pull Request branch in a single move. ⚡

git config --global alias.cpr '!f() { git fetch --quiet ${GIT_DEFAULT_REMOTE-origin} pull/$1/head:pulls/$1 && git checkout pulls/$1; }; f'

Usage

@jaredpar
jaredpar / evilnames.cs
Created November 5, 2019 00:27
Evil async and await C# code
using System;
using System.Runtime.CompilerServices;
public class C {
async async await(await async) => await async;
}
[AsyncMethodBuilder(typeof(builder))]
class async {
public awaiter GetAwaiter() => throw null;
@akhansari
akhansari / event-sourced-user.fsx
Last active December 16, 2022 00:09
F# : Event Sourcing in a nutshell
// ========= Event Sourcing in a nutshell
(*
FriendlyName: string
Aggregate friendly name.
Initial: 'State
Initial (empty) state we will start with.
Decide: 'Command -> 'State -> 'Event list
@akhansari
akhansari / onion-1.fs
Last active February 22, 2023 16:51
F# : Onion architecture in a nutshell
// 1. pure, don't think about IO at all
module Domain =
let add x y = x + y
// 2. think about IO but not its implementation
module App =
let add (getX: unit -> Async<int32>) y =
async {
let! x = getX ()
return Domain.add x y