Skip to content

Instantly share code, notes, and snippets.

:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

Block or report user

Report or block tugberkugurlu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 0001-cache-invalidation-imperatively.patch
From f629b295fc8f9bbd44904284cb0ec832d51185be Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 30 Apr 2019 09:55:44 +0100
Subject: [PATCH] cache invalidation, imperatively
---
postsharp/0-caching/1-sample-web/Startup.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/postsharp/0-caching/1-sample-web/Startup.cs b/postsharp/0-caching/1-sample-web/Startup.cs
View 0001-cache-invalidation-declarative.patch
From f0889e68e55298e43360e01dd3b0e8b1cf6468e3 Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 30 Apr 2019 09:40:21 +0100
Subject: [PATCH] cache invalidation, declarative
---
postsharp/0-caching/1-sample-web/Startup.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/postsharp/0-caching/1-sample-web/Startup.cs b/postsharp/0-caching/1-sample-web/Startup.cs
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)
You can’t perform that action at this time.