Skip to content

Instantly share code, notes, and snippets.

:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

View GitHub Profile
View 0001-add-caching.patch
From a20fc8e95ffd9bf5d424467e0e1283ae5891454a Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 9 Apr 2019 23:38:32 +0100
Subject: [PATCH] add caching
---
postsharp/0-caching/1-sample-web/1-sample-web.csproj | 1 +
postsharp/0-caching/1-sample-web/Program.cs | 3 +++
postsharp/0-caching/1-sample-web/Startup.cs | 4 +++-
3 files changed, 7 insertions(+), 1 deletion(-)
View Startup.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
View 0001-log.patch
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
+using PostSharp.Patterns.Diagnostics;
+using PostSharp.Patterns.Diagnostics.Backends.Console;
namespace _1_sample_web
{
+ [Log(AttributeExclude = true)]
public class Program
View GlobalAspects.cs
using PostSharp.Patterns.Diagnostics;
using PostSharp.Extensibility;
[assembly: Log(AttributePriority = 1, AttributeTargetMemberAttributes = MulticastAttributes.Protected | MulticastAttributes.Internal | MulticastAttributes.Public)]
[assembly: Log(AttributePriority = 2, AttributeExclude = true, AttributeTargetMembers = "get_*" )]
@tugberkugurlu
tugberkugurlu / Program.cs
Created Jan 14, 2019
Call private methods on implementation of the abstract class. This could be handy for the abstract Aggregate class which can get the event stream and populate the aggregate.
View Program.cs
using System;
using System.Linq;
using System.Reflection;
namespace abstract_impl_reflect
{
public class Foo : FooBase
{
public Foo() : base()
{
View LRUCache.cs
public class LRUCache
{
private readonly int _capacity;
private readonly IDictionary<int, LinkedListNode<Tuple<int, int>>> _store = new Dictionary<int, LinkedListNode<Tuple<int, int>>>();
private LinkedList<Tuple<int, int>> _accessLog = new LinkedList<Tuple<int, int>>();
public LRUCache(int capacity)
{
_capacity = capacity;
}
View SlientExceptionHandlerMiddleware.cs
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Zleek.Server.Common
{
public class SlientExceptionHandlerMiddleware
{
private readonly RequestDelegate _next;
@tugberkugurlu
tugberkugurlu / program.fs
Created Mar 19, 2018
F# pattern matching sample
View program.fs
// Learn more about F# at http://fsharp.org
type Shape =
| Rectangle of width : float * length : float
| Circle of radius : float
| Prism of width : float * float * height : float
let rect = Rectangle(length = 1.3, width = 10.0)
let circ = Circle(1.0)
View error.md
Error RZ9999: Found a malformed 'body' tag helper. Tag helpers must have a start and end tag or be self closing.
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
View paket.dependencies
source https://nuget.org/api/v2
// NuGet packages from https://nuget.org/api/v2 source
nuget NUnit ~> 2.6.3
source https://my-nuget-server.example.com/api/v2
// NuGet packages from https://my-nuget-server.example.com/api/v2 source
nuget FAKE ~> 3.4
nuget DotNetZip >= 1.9
You can’t perform that action at this time.