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 / 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 / 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
@AlexZeitler
AlexZeitler / gist:3312858
Created August 10, 2012 09:22
Renaming entities with RavenDb patching API
using System.Linq;
using System.Threading;
using Raven.Abstractions.Data;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Json.Linq;
using Xunit;
namespace RavenDbPatching.StringIdPatching {
@AlexZeitler
AlexZeitler / check if required tool can be executed
Last active October 3, 2020 13:06
check_required_software.sh
function check_required_software() {
ERROR=""
! [ -x "$(command -v curl)" ] && ERROR="$ERROR- curl\n"
! [ -x "$(command -v jq)" ] && ERROR="$ERROR- jq\n"
if [ -n "$ERROR" ]; then
echo "Some software is missing to run this script."
echo "Please make sure that you've installed:"
echo $ERROR >&2
type Person = {
firstName: string
lastName: string
middleName?: string
}
const hasValue = (value: Record<string, any>, property: any): boolean =>
Boolean(value[property])
type ValueOf<T> = T[keyof T]