Skip to content

Instantly share code, notes, and snippets.

@rakjin
rakjin / DeserializeTaggedType.md
Created May 12, 2022 10:10 — forked from shadeglare/DeserializeTaggedType.md
Deserialize JavaScript/TypeScript tagged type (discriminated union) with C# and Newtonsoft.Json

TypeScript protocol for a JSON response object (from node.js backend for example):

interface Circle {
  type: "circle";
  radius: number;
}

interface Square {
  type: "square";
  size: number;
@rakjin
rakjin / script-template.sh
Created January 17, 2021 04:02 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@rakjin
rakjin / index.html
Last active August 29, 2015 14:14 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #000;
}
</style>
<body>