var app = WebApplication.Create(args);
app.MapGet("/", () => "Hello World");
This file contains hidden or 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
| //live: https://scastie.scala-lang.org/dadhi/G2uzgCqXSbiav34bM602iw/68 | |
| trait EntryFactory[K] { | |
| def create(key: K): Entry[K] | |
| } | |
| object EntryFactory { | |
| implicit def anyFactory[K]: EntryFactory[K] = | |
| new EntryFactory[K] { | |
| override def create(key: K) = KEntry(key, key.hashCode) |
This file contains hidden or 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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
I've found that you can manually control which .dlls to reference and which .dlls to copy to output from a NuGet package if you turn off all assets on the PackageReference:
<PackageReference Include="Foo.MyPackage" Version="1.0.0" ExcludeAssets="all" GeneratePathProperty="true" />
and then manually reference the .dlls you need:
This file contains hidden or 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
| <Project> | |
| <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | |
| <PropertyGroup> | |
| <TargetFramework>netstandard1.0</TargetFramework> | |
| <IsPackable>true</IsPackable> | |
| <IncludeBuildOutput>false</IncludeBuildOutput> | |
| <ContentTargetFolders>contentFiles</ContentTargetFolders> | |
| <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> |
This file contains hidden or 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
| /* | |
| Execute me as: | |
| ``` | |
| dotnet tool install dotnet-script | |
| dotnet sctipt https://tinyurl.com/yylj3vcp | |
| ``` | |
| ```cs */ | |
| #r "nuget: Microsoft.Extensions.DependencyInjection, 2.2.0" | |
| #r "nuget: Microsoft.Extensions.Options, 1.0.0" |
This file contains hidden or 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
| Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } |
This file contains hidden or 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
| 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 { |