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
// Although this function works it may not be the best way and has some bug. | |
bool TryGetBasicAutheticationCredentials(string authorizationHeader, out string username, out string password) | |
{ | |
const string schemePrefix = "Basic "; | |
if (authorizationHeader != null && | |
authorizationHeader.StartsWith(schemePrefix, System.StringComparison.OrdinalIgnoreCase)) | |
{ | |
try | |
{ |
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
public static class HostFunctions | |
{ | |
public static void ConfigureServices(WebHostBuilderContext context, IServiceCollection services) => services | |
.AddSingleton<IMessageSerializer, JsonMessageSerializer>() | |
.AddSingleton(container => GetDbContextOptions(context.Configuration)) | |
.AddTransient<EventStoreDbContext, IdentityEventStoreDbContext>() | |
.AddSingleton<Func<EventStoreDbContext>>(container => container.GetRequiredService<EventStoreDbContext>) | |
.AddSingleton<ISqlEventStore, SqlEventStore>() | |
.AddSingleton<ISqlEventPublisher, SqlEventPublisher>() | |
.AddSingleton<ISqlEventSourcedRepository<User>, UserRepository>() |
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; | |
namespace AnonymousFunctionsVsLocalFunctions | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var functions = new Functions(); |
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
.class public auto ansi beforefieldinit FailFastAsync.Functions | |
extends [mscorlib]System.Object | |
{ | |
.method public hidebysig specialname rtspecialname instance void .ctor () cil managed | |
{ | |
IL_0000: ldarg.0 | |
IL_0001: call instance void [mscorlib]System.Object::.ctor() | |
IL_0006: ret | |
} |
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.Threading.Tasks; | |
namespace FailFastAsync | |
{ | |
public class Program | |
{ | |
public static async Task Main(string[] args) | |
{ | |
var functions = new Functions(); |
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.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace RxUnitTest | |
{ | |
[TestClass] | |
public class CombineLatestTest | |
{ |
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 Append-Path { | |
param([string]$path) | |
if (Test-Path $path) { $env:Path += (";" + $path) } | |
} | |
Append-Path("${env:ProgramFiles}\MSBuild\14.0\Bin") | |
Append-Path("${env:ProgramFiles(x86)}\MSBuild\14.0\Bin") |
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.Diagnostics; | |
using System.Reflection; | |
namespace CallPerf | |
{ | |
internal interface ICounter | |
{ | |
long Count { get; } |
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.Diagnostics; | |
namespace Optimization | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var instance = new Program(); |
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.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http.Controllers; | |
using System.Web.Http.Filters; | |
using static AttributeTargets; |
NewerOlder