BenchmarkDotNet=v0.12.1, OS=macOS 11.6 (20G165) [Darwin 20.6.0]
Intel Core i5-6267U CPU 2.90GHz (Skylake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=5.0.401
[Host] : .NET Core 5.0.10 (CoreCLR 5.0.1021.41214, CoreFX 5.0.1021.41214), X64 RyuJIT
DefaultJob : .NET Core 5.0.10 (CoreCLR 5.0.1021.41214, CoreFX 5.0.1021.41214), X64 RyuJIT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using BenchmarkDotNet; | |
using BenchmarkDotNet.Attributes; | |
namespace dictionary_vs_array | |
{ | |
public class Benchmarks | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://dev.to/gypsydave5/fizz-buzz-in-typescript-7ip (with some corrections) | |
type Z = 0; | |
type S<N> = [N]; | |
type N1 = S<Z>; | |
type N2 = S<N1>; | |
type N3 = S<N2>; | |
type N4 = S<N3>; | |
type N5 = S<N4>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
namespace MyBenchmarks | |
{ | |
public class IfVsSwitch | |
{ | |
private Random random = new Random(42); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nullable enable | |
using System; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Reflection; | |
public static partial class Utils | |
{ | |
/// <summary>Based on https://stackoverflow.com/a/58454489 with simplifications/comments added</summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace LifxNet | |
{ | |
/// <summary> | |
/// Based on https://stackoverflow.com/a/22938345 . Ideally we'd use BufferBlock from the TPL Dataflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nextcommit($targetBranch) { | |
$nextHash = git rev-list --topo-order HEAD..$targetBranch | select -last 1 | |
git checkout $nextHash | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run the elixir docker image and share the current directory into the container | |
docker run -v "$PWD`:/data" -it --rm elixir /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function confirm($message) { | |
$reply = Read-Host -Prompt "$message [y/n]" | |
return $reply -match "[yY]" | |
} | |
git for-each-ref --format='%(refname:short)' refs/heads | ` | |
where { $_ -ne 'master' } | ` | |
where { confirm "Delete branch $_ ?" } | ` | |
foreach { echo "git branch -D $_" } |
instead of
if (use_alternate_frob_strategy) {
bloo_counter += 1;
}
do
NewerOlder