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
open System | |
open System.IO | |
let printMeanScore(row: string) = | |
let columns = row.Split('\t') | |
let name = columns.[0] | |
let id = columns.[1] | |
let scores = columns |> Array.skip 2 |> Array.map float | |
let avg = scores |> Array.average | |
let min = scores |> Array.min |
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 ConsoleApp11; | |
var sl = new SpinLock(); | |
for (int i = 0; i < 3; i++) | |
{ | |
_ = Task.Run(() => DoSomething(ref sl)); | |
} | |
Console.WriteLine("Ready"); | |
Console.ReadLine(); |
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.Net.Sockets; | |
int iterations = 10; | |
long totalElapsed = 0; | |
for (int i = 0; i < iterations; i++) | |
{ | |
var tcpClient = new TcpClient(); | |
var sw = System.Diagnostics.Stopwatch.StartNew(); | |
await tcpClient.ConnectAsync("localhost", 6510); | |
long elapsed = sw.ElapsedMilliseconds; |
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
:root { | |
box-sizing: border-box; | |
} | |
*, ::before, ::after { | |
box-sizing: inherit; | |
} | |
html { | |
scroll-behavior: smooth; | |
} |
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
namespace Whatever | |
public static class IntegrationTestsServer | |
{ | |
public static string? IdentityConfirmationCode { get; private set; } | |
public static string? SignInOneTimeCode { get; private set; } | |
public static IOptions<GameServerOptions> GameServerOptions { get; set; } | |
private static readonly HttpClient HttpClient; | |
private static readonly IConfiguration Configuration; |
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.Collections.Concurrent; | |
namespace Whatever; | |
public static class EnumDescriptions | |
{ | |
private readonly static ConcurrentDictionary<Type, EnumDescriptionsCache> Cache = new(); | |
public static IEnumerable<KeyValuePair<Enum, string>> GetValuesAndDescriptions(Type enumType) => | |
GetOrAdd(enumType).GetAll(); |
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.Collections.Concurrent; | |
using System.Reflection; | |
using CarePlace.Client.Services; | |
using Fluxor; | |
using MediatR; | |
namespace XXXXXXX.Client.ViewState; | |
public class ApiEffects | |
{ |
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 Gambit.GameServer.Contracts; | |
using Gambit.GameServerIntegrationTests.Drivers; | |
namespace Gambit.GameServerIntegrationTests.Features.Users; | |
[Binding] | |
public class SignInStepDefinitions | |
{ | |
private readonly UserDriver UserDriver; | |
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
// BenchmarkDotNet benchmarks to test the speed of .net framework immutable classes | |
// See this image for results => https://user-images.githubusercontent.com/3111981/165134368-5875560d-47ef-4627-b51f-854e0cf24d36.png | |
using BenchmarkDotNet.Attributes; | |
using System.Collections.Immutable; | |
namespace ConsoleApp20; | |
[MemoryDiagnoser] | |
public class BM |
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
// Benchmarks | |
using BenchmarkDotNet.Attributes; | |
using LanguageExt; | |
using System.Collections.Immutable; | |
namespace MyImmutableArray; | |
[MemoryDiagnoser] | |
public class Benchmarks | |
{ |