Skip to content

Instantly share code, notes, and snippets.

View Saladressing's full-sized avatar

Jordan Saladressing

  • Toronto, Canada
View GitHub Profile
@Saladressing
Saladressing / AnonymousSessionMiddleware.cs
Created March 29, 2019 00:41
SampleAnonymousSessionMiddleware
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authentication;
using System.Security.Claims;
public class AnonymousSessionMiddleware
{
private readonly RequestDelegate _next;
public AnonymousSessionMiddleware(RequestDelegate next)
{
@Saladressing
Saladressing / gist:fd25ba199777bb9f497e98ec03bc88b0
Last active November 1, 2018 20:40
BackgroundService Example in NET core
// TestBackgroundService.cs
public class TestBackgroundService : BackgroundService, IHostedService
{
private readonly ILogger _logger;
public TestBackgroundService(ILogger<TestBackgroundService> logger)
{
_logger = logger;
}
var stats = {"updatedAt":1474997057,"packages":{"asset":{"releasedAt":"2015-02-10","total":548249,"perDay":1523.5,"perSecond":0.017633101851852},"assetic-bundle":{"releasedAt":"2012-04-13","total":11071584,"perDay":13492.7,"perSecond":0.15616550925926},"browser-kit":{"releasedAt":"2012-04-13","total":11119615,"perDay":15034.1,"perSecond":0.17400578703704},"cache":{"releasedAt":"2016-01-19","total":71133,"perDay":648.6,"perSecond":0.0075069444444444},"class-loader":{"releasedAt":"2012-04-13","total":5975899,"perDay":13641.066666667,"perSecond":0.15788271604938},"config":{"releasedAt":"2012-04-13","total":11601093,"perDay":22491.4,"perSecond":0.26031712962963},"console":{"releasedAt":"2012-04-13","total":31908522,"perDay":62525.766666667,"perSecond":0.72367785493827},"css-selector":{"releasedAt":"2012-04-13","total":17984302,"perDay":36953.866666667,"perSecond":0.42770679012346},"debug":{"releasedAt":"2013-04-07","total":19754360,"perDay":40667.6,"perSecond":0.47068981481481},"debug-bundle":{"releasedAt":"2