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
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 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
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 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
:root { | |
box-sizing: border-box; | |
} | |
*, ::before, ::after { | |
box-sizing: inherit; | |
} | |
html { | |
scroll-behavior: smooth; | |
} |
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
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 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
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 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
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 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
<Morris.Blazor.Web.Modal.Modal Visible=@IsVisible title="Invite a user" aria-title="Invite a user"> | |
<div class="card p-3 shadow"> | |
<main> | |
<div class="modal-content"> | |
<div class="modal-header card-header pb-2"> | |
<h1 class="modal-title lead font-weight-bold" tabindex="-1">Invite a user</h1> | |
</div> | |
<div class="modal-body p-3"> | |
</div> | |
<div class="modal-footer card-footer"> |
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
public static class StringHelper | |
{ | |
public const byte DefaultUnobscuredLength = 3; | |
public enum Keep { Start, End }; | |
public static string? ObscureEmailAddress(string? value) | |
{ | |
if (string.IsNullOrEmpty(value)) | |
return value; |
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
public static class IntegrationTestsServer | |
{ | |
static IntegrationTestsServer() | |
{ | |
ConfigureMocks(); | |
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "IntegrationTesting"); | |
WebApplicationFactory<Program> appBuilder = new WebApplicationFactory<Program>() | |
.WithWebHostBuilder(builder => | |
{ | |
builder.ConfigureTestServices(services => |
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
public sealed class DisposableCallback : IDisposable | |
{ | |
private readonly Action Action; | |
private readonly string CallerFilePath; | |
private readonly int CallerLineNumber; | |
private readonly bool WasCreated; | |
private bool IsDisposed; | |
/// <summary> | |
/// Creates an instance of the class |