Skip to content

Instantly share code, notes, and snippets.

@sanisoclem
sanisoclem / load-env.sh
Created December 7, 2022 03:16
Load .env
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
@sanisoclem
sanisoclem / hkt.ts
Created October 20, 2022 16:59
TypeScript HKTs - Codec, Forms
/// Roughly
///type TxnSchema :: (Type -> Type) -> Row Type
///type TxnSchema f = (
/// name :: f String
/// amount :: f Number
///);
///
///type Codec a =
/// { encode: a -> Json
/// , decode: Json -> Option a }
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#546E7A",
"foreground": "#26C6DA",
"leading_diamond": "",
Set-ExecutionPolicy RemoteSigned -Scope Process
Screenfetch
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme ~\.mel.omp.json
@sanisoclem
sanisoclem / life.fs
Last active November 4, 2020 00:14
F# Lifesavers
// https://stackoverflow.com/a/54714775/3004147
module Result =
open Result
let rtn = Ok
let toOption r = r |> function Ok v -> Some v | _ -> None
let defaultWith f r = r |> function Ok v -> v | Error e -> f e
let defaultValue d r = r |> function Ok v -> v | Error _ -> d
let failIfTrue m v = if v then m |> Error else Ok ()
let failIfFalse m v = if not v then m |> Error else Ok ()

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@sanisoclem
sanisoclem / .gitconfig
Last active July 26, 2023 01:49
Git Aliases
[alias]
ls = log --decorate --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]"
tree = log --oneline --decorate --all --graph
acm = !git add . && git commit -m
ac = !git add . && git commit
acf = !git add . && git commit --fixup HEAD
ds = diff --stat
dc = diff --cached
dcs = diff --stat --cached