Skip to content

Instantly share code, notes, and snippets.

@bdrupieski
bdrupieski / SimpleFluentInterface.cs
Last active March 17, 2022 02:51
Simple fluent interface in C#
using System;
using System.Collections.Generic;
namespace SimpleFluentInterface
{
class Program
{
static void Main(string[] args)
{
string s = ListEnrollmentsSelectBuilder.Create()
@bdrupieski
bdrupieski / fixed-width-table.js
Last active April 3, 2020 17:05
extract output from DataGrip into evenly spaced fixed width columns so it's readable when you paste it into Slack
if (!String.prototype.repeat) {
// polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
String.prototype.repeat = function(count) {
'use strict';
if (this == null) {
throw new TypeError('can\'t convert ' + this + ' to object');
}
var str = '' + this;
count = +count;
if (count != count) {
@bdrupieski
bdrupieski / Program.cs
Created December 3, 2019 22:47
delete unbound persistent volume claims
using System;
using System.Linq;
using System.Threading.Tasks;
using k8s;
namespace KubeStuff
{
class Program
{
static async Task Main(string[] args)
@bdrupieski
bdrupieski / CompareForEachToParallelForEachForAddingToDictionary.cs
Created March 12, 2017 13:53
Performance and correctness comparison between foreach and Parallel.ForEach for adding items to a generic Dictionary<TKey, TValue>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace App
{
/// <summary>
/// This snippet shows a performance and correctness comparison between
@bdrupieski
bdrupieski / GenerateNatoAlphabetAnkiCards.cs
Created March 11, 2017 23:42
Generate NATO alphabet Anki cards
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MoreLinq;
namespace App
{
public static class GenerateNatoAlphabetAnkiCards
{
@bdrupieski
bdrupieski / MigrateOrigins.cs
Created March 11, 2017 18:39
Update origin for all git repositories in a folder
using System;
using System.Diagnostics;
using System.IO;
namespace App
{
public static class MigrateOrigins
{
public static void DoIt(string[] args)
{
@bdrupieski
bdrupieski / CompareForeachToParallelForeach.cs
Created March 11, 2017 17:32
Performance and correctness comparison between foreach and Parallel.ForEach
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
namespace App
{
/// <summary>
/// This snippet shows a performance and correctness comparison between
/// foreach and Parallel.ForEach when adding a small number of objects to a
@bdrupieski
bdrupieski / ConfigurablePolymorphicFluentInterface.cs
Created July 21, 2016 00:31
Configurable polymorphic fluent interface in C#
using System;
using System.Collections.Generic;
namespace ConfigurablePolymorphicFluentInterface
{
public class Program
{
static void Main(string[] args)
{
string s = ListEnrollmentsSelectBuilder.Create()