Skip to content

Instantly share code, notes, and snippets.

View magnusbakken's full-sized avatar

Magnus Grindal Bakken magnusbakken

View GitHub Profile
@magnusbakken
magnusbakken / CustomXmlCommentsSchemaFilter.cs
Created January 31, 2022 10:38
A custom Swashbuckle schema filter that adds remarks to schema descriptions.
using System.Xml.XPath;
using Microsoft.OpenApi.Models;
namespace Swashbuckle.AspNetCore.SwaggerGen;
// This is a slightly modified version of the built-in XmlCommentsSchemaFilter.
// Currently our only modifications are that we append the contents of the <remarks> section to the description for each schema item.
public class CustomXmlCommentsSchemaFilter : ISchemaFilter
{
@magnusbakken
magnusbakken / Algorithms.cs
Created November 19, 2019 10:12
Comparison of different methods of creating hex output for a byte array with Benchmark.NET.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BenchmarkDotNet.Attributes;
namespace HexBenchmark
{
public class Algorithms
{
@magnusbakken
magnusbakken / actions.diff
Created March 19, 2018 13:25
ts-action before/after
diff --git <redacted>
index 8c60296..57a1aa1 100644
--- <redacted>.ts
+++ <redacted>.ts
@@ -1,45 +1,26 @@
-// tslint:disable:max-classes-per-file
-import { Injectable } from "@angular/core";
-import { Action } from "redux";
-
-import { Article, ArticleScheme } from "<redacted>";
@magnusbakken
magnusbakken / MyDbContext.cs
Created January 8, 2018 13:29
Workaround for transactions with Effort for Entity Framework 6
using System;
using System.Data;
using System.Data.Entity;
namespace MyNamespace
{
public partial class MyDbContext : DbContext
{
public bool IsInMemoryTestContext { get; set; }