Skip to content

Instantly share code, notes, and snippets.

dadhi /
Created Aug 20, 2020 — forked from pierrejoubert73/
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!


  1. A numbered
  2. list
    • With some
    • Sub bullets
dadhi / X.Y.Z.Sources.csproj
Created Jul 22, 2020 — forked from attilah/X.Y.Z.Sources.csproj
X.Y.Z.Sources nuget package
View X.Y.Z.Sources.csproj
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
dadhi / DryIoc_Issue293.csx
Last active Jul 19, 2020
DryIoc issue #293: ServiceKey and ServiceProvider
View DryIoc_Issue293.csx
Execute me as:
dotnet tool install dotnet-script
dotnet sctipt
```cs */
#r "nuget: Microsoft.Extensions.DependencyInjection, 2.2.0"
#r "nuget: Microsoft.Extensions.Options, 1.0.0"
dadhi /
Created Jul 1, 2020
Remove Cleanup Obj and Bin folders powershell script
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
View ZLayerPlayground.scala
import zio._
object ZLayerPlayground {
case class User(id: String, name: String)
class MongoDb {
def insertUser(user: User): Task[Unit] = Task.succeed(()) <* UIO(println(s"[MongoDb]: Inserted user $user"))
object MongoDbLayer {
dadhi / Demo.csproj
Last active May 8, 2020 — forked from danielcrenna/Demo.csproj
DI Source Generator
View Demo.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0-preview.3.20215.2" />
dadhi / SpinWait.cs
Created Jan 8, 2020
Better SpinWait
View SpinWait.cs
A better spin lock:
The result is a spin lock that's quite fast — about twice as fast as locking with a Monitor (or the C# lock statement).
(It can be further sped up slightly by breaking the Enter method into two methods: Enter,
dadhi / AddGeneratedFile.csproj
Created Oct 9, 2019 — forked from KirillOsenkov/AddGeneratedFile.csproj
Sample of generating a .cs file during build and adding it to the compilation
View AddGeneratedFile.csproj
<Project Sdk="Microsoft.NET.Sdk">
using System%3B
dadhi / WrappingImmutableValueInMutableBox.cs
Last active Apr 17, 2019
Wrapping immutable value in a mutable box
View WrappingImmutableValueInMutableBox.cs
using System;
using ImTools;
public class Program
public static void Main()
var map = ImHashMap<string, string>.Empty;
var map1 = map.AddOrUpdate("a", "42");
View DictionarySlimWtf.cs
private DictionarySlim<TypeVal, string> _dict;
public DictionarySlim<TypeVal, string> DictSlim()
var dict = new DictionarySlim<TypeVal, string>();
foreach (var key in _keys.Take(Count))
dict.GetOrAddValueRef(key) = "a";
dict.GetOrAddValueRef(typeof(ImHashMapBenchmarks)) = "!";