Skip to content

Instantly share code, notes, and snippets.

@jongalloway
jongalloway / aspnetcore-one-hour-makeover.md
Last active April 30, 2022 08:24
ASP.NET Core One Hour Makeover
@andrewabest
andrewabest / motivation.md
Last active February 6, 2018 03:33
What motivates developers?

A pyramid, much like Maslow's heirarchy of needs

Peak: Impact and Purpose

  • Seeing the results of the physical and emotional investment in our work, regularly
  • Realizing our visions
  • Validation of the efforts we expended and decisions we made with autonomy
  • Quantifying and celebrating the impact we have had on peoples lives via our work
  • Recieving reward, praise, or other kind of recognition for our accomplishments
  • Outcomes over output
@aL3891
aL3891 / dateformatbenchmark.cs
Last active October 6, 2016 08:48
dateformat
using System;
using static System.Text.Encoding;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Running;
using Xunit;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@gcollic
gcollic / SerilogLinqpad.cs
Last active May 17, 2018 15:25
Trying Serilog in LinqPad ( gist version of https://twitter.com/adamchester/status/726965534693056513 )
void Main()
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Warning()
.Enrich.FromLogContext()
.Enrich.WithProperty("url", "http://serilog.net/")
.WriteTo.Sink(new LinqpadDumpSink())
.CreateLogger();
Log.Warning(
"Processing inside {@test}, something weird happened",
@rasmuskl
rasmuskl / LogEventJsonConverter.cs
Last active March 16, 2021 21:57
Json.NET JsonConverters for deserializing Serilog's LogEvents.
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serilog.Events;
using Serilog.Parsing;
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@vvreutskiy
vvreutskiy / WebApi.linq
Created April 17, 2016 08:51
F# WebApi selfhosted inside LinqPad
<Query Kind="FSharpProgram">
<NuGetReference>Microsoft.AspNet.WebApi.SelfHost</NuGetReference>
</Query>
type ResponseRecord = {value: int; message: string}
type ResponseDiscriminatedUnion =
| Even of ResponseRecord
| Odd of (int * string)
let getResponse i =
@praeclarum
praeclarum / Parsing.fs
Last active November 26, 2020 22:29
Parser combinator in F# tuned to perform "well enough" on iOS (Xamarin)
module Parsing
/// Remember where we are in the code.
/// This is a struct to keep memory pressure down.
/// (Significant perf improvements on iOS.)
type ParseState =
struct
val Code : string
val Index : int
new (code : string, index : int) =
@sheastrickland
sheastrickland / Landlord.cs
Created September 7, 2015 06:22
Landlord: The Com Destroyer. A simple utility class to wrap those nasty little devils.
using System;
using System.Runtime.InteropServices;
namespace Things
{
public static class LandLordExtensions
{
public static LandLord<TWrapped> AsDisposable<TWrapped>(this TWrapped tenant)
{
return new LandLord<TWrapped>(tenant);
[<AutoOpen>]
module UoM =
// Units of measure for other than integral types
let inline (++) (w: ^W when ^W: (static member IsMeasureAbbrev: ^tm * ^t -> unit)) (t: ^t) = (# "" t: ^tm #)
let inline (--) (w: ^W when ^W: (static member IsMeasureAbbrev: ^tm * ^t -> unit)) (tm: ^tm) = (# "" tm: ^t #)
[<MeasureAnnotatedAbbreviation>]
type Guid<[<Measure>] 'm> = Guid