Skip to content

Instantly share code, notes, and snippets.

View files.cs
public class PartitionedNamingStrategy
private static readonly Dictionary<string, Func<string, string>> NamingStrategies = new Dictionary<string, Func<string, string>>
{"none", s => s},
{"bymachine", s => $"{Environment.MachineName}_{s}"}
private readonly string _strategy;
hyrmn / main.cs
Created Oct 29, 2019
Two simple local functions
View main.cs
static decimal CalculateBalance(AccountId accountId)
//assume these things come in externally
var charges = new[] {new Charge(100M)};
var payments = new[] {new Payment(20M)};
var chargeBalance = Σ(charges.Select(c => c.Amount));
var paymentCredit = Σ(payments.Select(p => p.Amount));
return chargeBalance - paymentCredit;
hyrmn / dbmigrator.csproj
Created Oct 18, 2019
refuses to pick up new files unless I clean or delete bin/obj first
View dbmigrator.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="DbUp-SqlServer" Version="4.2.0" />
<PackageReference Include="OctoPack" Version="3.0.31" />
hyrmn / capslockwarning.js
Created Oct 4, 2019
Show a little capslock warning if the user tries to log in while their capslock key is on.
View capslockwarning.js
(function() {
var capsLockEnabled = false;
document.onkeypress = function (e) {
e = e || window.event;
var s = String.fromCharCode(e.keyCode || e.which);
if (s.toLowerCase() === s.toUpperCase()) {
hyrmn / oldway.cs
Last active Mar 24, 2021
Polly.Contrib.WaitAndRetry examples
View oldway.cs
var transientErrors = new HashSet<WebExceptionStatus>(new[]
hyrmn / DapperExtensions.cs
Last active Oct 18, 2021
Extension methods for calling Dapper asynchronously with a Polly retry
View DapperExtensions.cs
public static class DapperExtensions
private static readonly IEnumerable<TimeSpan> RetryTimes = new[]
private static readonly AsyncRetryPolicy RetryPolicy = Policy
View BenchmarkDotNetStringOptions.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

View gitconfig
name = Ben Hyrman
email =
autocrlf = true
editor = vim
excludesfile = C:\\Users\\B.Hyrman\\Documents\\gitignore_global.txt
helper = manager
View ServiceBusDispatcher.cs
using System;
using System.Collections.Concurrent;
using Anotar.Serilog;
using Microsoft.ServiceBus.Messaging;
using RezStream.Infrastructure;
namespace RezCloud.Infrastructure.AzureBus
public class Queues : Enumeration<Queues, string>