Skip to content

Instantly share code, notes, and snippets.

View AlexZeitler's full-sized avatar
👷‍♂️
Building stuff

Alexander Zeitler AlexZeitler

👷‍♂️
Building stuff
View GitHub Profile
@AlexZeitler
AlexZeitler / idiomaticjsonserialiser.fs
Created May 15, 2021 23:25 — forked from isaacabraham/idiomaticjsonserialiser.fs
This JSON.Net converter handles F# discriminated unions with more "idiomatic" JSON than what is generated by the current version of JSON .NET. Option types and single case DUs are transparently handled, and tuple-style properties are used rather than array notation.
namespace Newtonsoft.Json.Converters
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System
type IdiomaticDuConverter() =
inherit JsonConverter()
[<Literal>]
@AlexZeitler
AlexZeitler / SCU.fs
Created May 15, 2021 23:25 — forked from JordanMarr/SCU.fs
JSON.NET SCU Converter
// Single case union
[<Struct>] type MHPI = MHPI of double
// An entity that contains SCU
type Entity = {
Foo: string
Bar: MHPI
}
// JSON.NET Converter
namespace Infrastructure
open System.Text.Encodings.Web
open System.Text.Json
open System.Text.Json.Serialization
[<RequireQualifiedAccess>]
module JsonSerializer =
let private setupOptions (options: JsonSerializerOptions) =
options.PropertyNamingPolicy <- JsonNamingPolicy.CamelCase
@AlexZeitler
AlexZeitler / .editorconfig
Last active May 2, 2021 20:07
TypeScript + React + Tailwind + VS Code Project settings
root = false
[**/**.{yml,ts,tsx,js,json,jsx,html}]
indent_style = space
indent_size = 2
insert_final_newline = true
@AlexZeitler
AlexZeitler / .tmux.conf
Last active March 20, 2021 12:10
tmux / tmuxinator named panes sample
# enable named panes
set -g pane-border-format "#{pane_index} #{pane_title}"
set -g pane-border-status bottom
@AlexZeitler
AlexZeitler / .editorconfig
Last active August 30, 2021 11:33
TypeScript + Node + VS Code Project settings
root = false
[**/**.yml]
indent_style = space
indent_size = 2
insert_final_newline = true
[**/**.ts]
indent_style = space
indent_size = 2
@AlexZeitler
AlexZeitler / main.yml
Created January 10, 2021 22:16
.NET Core GitHub Action Template
name: .NET Core Build with Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
@AlexZeitler
AlexZeitler / Readme.md
Created January 4, 2021 15:35 — forked from skorfmann/Readme.md
Stub Lambda Functions in your CDK Stack

Stubbing Lambda Functions in your CDK Stack

Given you have a stack with one or more Lambda functions (e.g. as part of a Step Functions state machine), it can be pretty useful to stub long running parts with a known response.

This makes use of cdk Aspects, which allows modifying all or a filtered subsset of resources for a given scope (Stack, Construct).

In addition this leverages raw overrides to remove the original code of the Lambda function.

Please note, that the stub has to be in Python or NodeJS, since inlining code is only supported by those runtimes.

@AlexZeitler
AlexZeitler / event-sourced-user.fsx
Created December 29, 2020 15:34 — forked from akhansari/event-sourced-user.fsx
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