Skip to content

Instantly share code, notes, and snippets.

View svengeance's full-sized avatar

Sven svengeance

View GitHub Profile
@svengeance
svengeance / AsyncObjectPool.cs
Last active August 28, 2024 18:35
AsyncObjectPool - Sharing expensive objects in an async-friendly way using System.Threading.Channel<T>
public class AsyncObjectPool<T> where T : class
{
private readonly AsyncObjectPoolConfiguration<T> _configuration;
private readonly ChannelReader<T> _poolReader;
private readonly ChannelWriter<T> _poolWriter;
private readonly SemaphoreSlim _resizingLock = new(1, 1);
private int _currentSize;
public AsyncObjectPool(AsyncObjectPoolConfiguration<T> configuration)
@svengeance
svengeance / input.scss
Created August 25, 2021 21:28
Generated by SassMeister.com.
$highlighted-states: (
"success": (
"background": #c8e6c9,
"text": #224a23
),
"info": (
"background": #b3e5fc,
"text": #044868
),
"warn": (
@svengeance
svengeance / NLogConfiguration.cs
Created June 23, 2021 19:34
Pretty NLog Configuration, inspired by Serilog
public class NLogConfiguration
{
public static LoggingConfiguration CreateDefault()
{
Layout beautifulLayout = "[${time} ${level:padding=5}] (${logger:shortName=true}) ${message}";
var config = new LoggingConfiguration();
AddConsoleTarget(config, beautifulLayout);
foreach (var target in config.AllTargets)
@svengeance
svengeance / Test_Contents.txt
Created January 24, 2021 09:06
A poor way of writing HTTP integration tests
It's certainly *one* way of writing integration tests.
@svengeance
svengeance / generate-release-notes-template.hbs
Created July 5, 2020 22:16
This is a sample template for the Azure DevOps Generate Release Notes Task that, with minimal setup, produces output following the GitFlow strategy for development, testing, and production releases.
[[_TOC_]]
{{#if (eq (template) 'production')}}
## Production Release
### 🚀 [{{releaseDetails.name}}]({{get '_links.web.href' releaseDetails}})
**Started By:** {{releaseDetails.createdBy.displayName}}
**Start Time:** {{date releaseDetails.createdOn 'llll'}}
**Total # Work Items:** {{workItems.length}}
**Total # Commits:** {{commits.length}}