Skip to content

Instantly share code, notes, and snippets.

View output
{
"a": {
"b": {
"c": {
"d": 43
}
}
},
"f": "hello"
}
@gkinsman
gkinsman / profile.ps1
Created Feb 21, 2020
rider from command line
View profile.ps1
function Start-Rider([string] $sln) {
& "C:\Users\george.kinsman\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\JetBrains Toolbox\Rider.lnk" $sln
}
Set-Alias -Name rider -Value Start-Rider
View gist:8b2f7979f14b62b064549dcb4dbc1fbb
public class ExceptionFingerprintEnricher : ILogEventEnricher
{
private const string ThumbprintKey = "ExceptionThumbprint";
private const string TypeKey = "ExceptionType";
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
if (logEvent.Exception == null) return;
var fingerprint = ExceptionFingerPrinter.GetFingerprint(logEvent.Exception);
View IResult.cs
public interface IResult
{
bool WasSuccessful { get; }
string[] Errors { get; }
bool WasFailure { get; }
}
public class Result : IResult
{
View gist:58463acce161a492f89f176951157d3e
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg => {
cfg.UseLog4Net();
cfg.UseApplicationInsights(_telemetryClient);
cfg.PrefetchCount = (ushort)_settings.MessageBusPrefetchCount; // 10 in our config
host = cfg.Host("rabbitcluster", config.VHost, h => {
h.UseCluster(c => prioritisedHostNames.ForEach(c.Node));
h.Username(_shardConfigProvider.Username);
h.Password(_shardConfigProvider.Password);
h.PublisherConfirmation = _publisherConfirms;
@gkinsman
gkinsman / new_gist_file
Created Feb 21, 2017
UnhandledExceptionLogger
View new_gist_file
public static class UnhandledExceptionLogger
{
public static void Install()
{
var log = Log.ForContext(typeof(UnhandledExceptionLogger));
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
{
log.Fatal(e.ExceptionObject as Exception, "Unhandled exception caught at AppDomain boundary (terminating: {IsTerminating})", e.IsTerminating);
};
View gist:77acaea68633c759945848d761b79c75
import {customAttribute} from 'aurelia-framework';
import {autoinject} from 'aurelia-framework';
import * as $ from "jquery";
@autoinject
@customAttribute('found')
export class FoundationCustomAttribute {
constructor(private element: Element) {
}
@gkinsman
gkinsman / EnumerableOfStringParser
Created Mar 10, 2016
EnumerableOfStringParser
View EnumerableOfStringParser
public class EnumerableOfStringParser : IValueParser
{
private readonly string _separator;
public EnumerableOfStringParser(string separator = null)
{
_separator = separator;
}
public bool CanParse(Type settingValueType)
@gkinsman
gkinsman / Program
Last active Aug 29, 2015
Solution to Liam's Challenge 22/08/2015
View Program
using System;
namespace SemitoneCalculator
{
public static class ToneExtensions
{
public static Tone Up(this Tone tone)
{
return tone.Name == ToneName.B
? new Tone(ToneName.C, tone.Octave + 1)
@gkinsman
gkinsman / gist:6602731
Created Sep 18, 2013
Slight modification of http://tomasp.net/blog/2013/tuples-in-csharp/index.html to group by not only parameter type, but name as well
View gist:6602731
(*@
Note that this is directly from his blog post on https://github.com/tpetricek/TomaspNet.Website/blob/master/source/blog/2013/tuples-in-csharp.fsx
The only minor addition is on L162:
yield [ for p in meth.GetParameters() -> p.ParameterType.ToString() + ": " + p.Name ] }
where we added the name of the parameter in the key for the grouping. Results are interesting!
Also added a Dump on L180 for LinqPad :)
*)