Skip to content

Instantly share code, notes, and snippets.

View kshyju's full-sized avatar

Shyju Krishnankutty kshyju

View GitHub Profile
@kshyju
kshyju / ExceptionHandlingMiddleware.cs
Created May 16, 2022 03:13
Blog-2022_05_15_FunctionsMiddlewareApis
public class ExceptionHandlingMiddleware : IFunctionsWorkerMiddleware
{
private readonly ILogger<ExceptionHandlingMiddleware> _logger;
public ExceptionHandlingMiddleware(ILogger<ExceptionHandlingMiddleware> logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
@kshyju
kshyju / StringEqualsBenchmarks-Results.MD
Created April 22, 2022 21:31
StringEqualsBenchmarks
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22530
Unknown processor
.NET SDK=6.0.202
  [Host]     : .NET 5.0.16 (5.0.1622.16705), X64 RyuJIT
  DefaultJob : .NET 5.0.16 (5.0.1622.16705), X64 RyuJIT

@kshyju
kshyju / gist:3a0aacf2e5185e6932a1a16693ca6dd2
Created December 11, 2021 01:46 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kshyju
kshyju / Blog2021LinqIntersectAnyUsageSample.cs
Last active May 15, 2021 19:25
Blog-2021_05_15_LINQIntersectAny
IEnumerable<string> first = new[] {"one", "two", "three","four","five","six","seven","eight"};
IEnumerable<string> second = new[] { "two", "three"};
var matchFound = first.Intersect(second, StringComparer.OrdinalIgnoreCase).Any();
@kshyju
kshyju / STJ-JsonConverterTests
Last active April 26, 2021 20:38
Tests for Custom JsonConverter to handle arrays in non valid format
public sealed class Person
{
public string FullName { get; set; }
[JsonConverter(typeof(VehiclesArrayConverter))]
public List<Vehicle>? Vehicles { get; set; }
public string[] Aliases { get; set; }
}
@kshyju
kshyju / LinqVsMyLinq
Last active April 21, 2021 19:26
LinqVsMyLinq-For-JB_Reference
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@kshyju
kshyju / SliceToMultiple-SpanVsSubString
Created March 22, 2021 06:50
SliceToMultiple-SpanVsSubString
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
namespace Benchmark_ToListCall
{
[MemoryDiagnoser]
public class StringBenchmarks2
{
private string stringToSlice;
@kshyju
kshyju / DeDupeDictionaryEntries-LINQGroupByFirstvsNONLINQ.cs
Created October 23, 2020 16:49
DeDupeDictionaryEntries-LINQGroupByFirstvsNONLINQ benchamarks
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Benchmark_ToListCall
{
[MemoryDiagnoser]
public class DictionaryBenchmarks
{
@kshyju
kshyju / IReadOnlyList Enumerator allocation
Created October 20, 2020 18:09
IReadOnlyList ForEach vs Array ForLoop - allocation
Result
``` ini
BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Xeon CPU E5-1650 v4 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=5.0.100-rc.2.20479.15
[Host] : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT
DefaultJob : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT
@kshyju
kshyju / Perfview Tips
Last active June 8, 2020 02:21
Perfview tips
Run D:\Windows\System32\inetsrv> appcmd list wps
Get the Id for the app pool for the app