Skip to content

Instantly share code, notes, and snippets.

@mjgoeke
mjgoeke / ts-logger-examples.md
Last active November 11, 2021 12:43
ts-logger examples

example @logger.* decorator usages

@logger.logClass()
export class SimplestExample {
  //all methods except those matching ignorePattern will get wrapped with trace style logging
  ...
}

@logger.logClass()
export class LoginService {
@mjgoeke
mjgoeke / memoize.cs
Created December 25, 2020 08:21
C# memoize higher order functions by using tuples
using System;
using System.Collections.Concurrent;
namespace ns
{
//even though this looks like it only takes functions with one input
// by using C# tuple types, one can have any number of inputs (or outputs)
// see example below
public class Memoized<T, TResult>
{