Skip to content

Instantly share code, notes, and snippets.

View jbw's full-sized avatar
is focusing

Jason Watson jbw

is focusing
View GitHub Profile
@jbw
jbw / command_handler_pattern.go
Created November 29, 2022 11:21
Basic 1 to 1 command handler separation example
package command_handler_pattern
import (
"reflect"
)
type NotificationHandler[TNotification any] interface {
Handle(notification TNotification) error
}
@jbw
jbw / logging.cs
Created January 7, 2021 15:26
Example JSON structure output using Serilog
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Exceptions;
using Serilog.Formatting.Json;
using System;
using System.Threading;
using System.Threading.Tasks;

Keybase proof

I hereby claim:

  • I am jbw on github.
  • I am jasonbwatson (https://keybase.io/jasonbwatson) on keybase.
  • I have a public key whose fingerprint is BB27 CE3D C373 E213 56D2 4454 C058 C873 AC51 3884

To claim this, I am signing this object:

using DotNetRemotingExample;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
static List<long> RunSerializer(IJsonSerializer jsonSerializer, int iterations, TestObj testObj)
{
var timing = new List<long>();
var sw = new Stopwatch();
for (int i = 0; i < iterations; i++)
{
sw.Start();
var serialised = jsonSerializer.SerializeToString(testObj);
sw.Stop();