Skip to content

Instantly share code, notes, and snippets.

Andrew Stanton-Nurse anurse

Block or report user

Report or block anurse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
anurse / CommandLineException.cs
Last active Oct 16, 2019
My Command Line Template
View CommandLineException.cs
using System;
using System.Runtime.Serialization;
namespace MyTool
internal class CommandLineException : Exception
public CommandLineException()
anurse /
Last active Mar 20, 2019
EventSource/EventCounters patterns
anurse / AzureFunctionsLoggingProvider.cs
Last active Aug 14, 2018
Azure Functions Logging Provider
View AzureFunctionsLoggingProvider.cs
public static class AzureFunctionsLoggerBuilderExtensions
public static void AddAzureFunctions(this ILoggingBuilder logging, TraceWriter writer)
logging.Services.AddSingleton<ILoggerProvider, AzureFunctionsLoggerProvider>();
public class AzureFunctionsLoggerProvider : ILoggerProvider
anurse / drill
Last active Feb 2, 2018
My VIM drill
View drill
VIM Drill
NEVER USE Arrows or Esc!
1. Type the following:
public class Foo {
public string Property { get; set; }
public int Property { get; set; }
anurse / WebsocketDecoder.ts
Last active Dec 4, 2017
WebSocket Decoder Script
View WebsocketDecoder.ts
document.writeln('<input style="width: 600px" id="hexcode" type="text" placeholder="hex values" />');
document.writeln('<button onclick="decode()">Decode</button>');
document.writeln('<div id="result" />');
var opcodes = [
anurse / SampleMetric.cs
Last active Sep 19, 2017
Sample IMetric implementation for aggregated data.
View SampleMetric.cs
using Microsoft.Extensions.Logging;
namespace MetricsSample
internal class SampleMetric : IMetric
private object _lock = new object();
private int _count;
private double _sum;
View DynamicHubSketch.cs
// Treat Client Proxies kinda like Formatters; Hub<T> just tries to get an IClientProxyFactory<T> from DI and invokes it.
// We provide one for `dynamic` and another that can be registered as an open-generic and generated code at runtime.
// Users can provide custom implementations for anything.
public interface IClientProxy {
Task InvokeAsync(string method, params object[] args);
public interface IClientProxyFactory<T> {
T CreateProxy(IClientProxy proxy); // <-- may need some caching logic
anurse / gist:5485124
Created Apr 29, 2013
Azure Portal Full Width
View gist:5485124
#headerbar-wrapper {
width: 100%;
margin-left: 0;
left: 0;
#fxshell-navpane {
left: 0;
margin-left: 0;
#drawer {
anurse / ReadAtLeastAsync.cs
Created Sep 27, 2016
ReadAtLeastAsync Helper
View ReadAtLeastAsync.cs
using System.Threading;
using System.Threading.Tasks;
using Channels;
namespace Microsoft.Extensions.WebSockets.Internal
public static class ChannelExtensions
public static ValueTask<ReadableBuffer> ReadAtLeastAsync(this IReadableChannel input, int minimumRequiredBytes) => ReadAtLeastAsync(input, minimumRequiredBytes, CancellationToken.None);
anurse / .gitignore
Created Aug 31, 2016
WebSocket Repro Client
View .gitignore
You can’t perform that action at this time.