Instantly share code, notes, and snippets.

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
View Program.cs
private static int Main(string[] args)
if (args.Any(a => a == "--debug"))
args = args.Where(a => a != "--debug").ToArray();
Console.WriteLine($"Ready for debugger to attach. Process ID: {Process.GetCurrentProcess().Id}.");
Console.WriteLine("Press ENTER to continue.");
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
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);
View .gitignore
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 = [
View vimrc
" Update MYVIMRC
let $MYVIMRC="~/.dotfiles/vim.symlink/vimrc"
let $MYCOLORS="~/.dotfiles/vim.symlink/colorscheme.vim"
set ff=unix
" Make windows accept unixy stuff
if has('win32') || has('win64')
set runtimepath=~/.vim,$VIM/vimfiles,$VIM,$VIM/vimfiles/after,~/.vim/after
set dir=$TEMP

MSBuild Targets and Props in NuGet 3

NuGet 2.x supports the inclusion of .targets and .props files in NuGet packages. These files will be added as Imports in the csproj MSBuild file when the package is installed. For example, consider a package with the following files: