Skip to content

Instantly share code, notes, and snippets.

View SebastianStehle's full-sized avatar
🏠
Working from home

Sebastian Stehle SebastianStehle

🏠
Working from home
View GitHub Profile
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.Framework.Runtime;
using System;
using System.IO;
using System.Text;
namespace BundleHelpers
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.Framework.Runtime;
using System;
using System.IO;
using System.Text;
namespace BundleHelpers
public sealed class CanvasControlWrapper : ICanvasControl
{
public event EventHandler<CanvasDrawEventArgs> Draw;
private void OnDraw(CanvasDrawEventArgs e)
{
Draw?.Invoke(this, e);
}
public CanvasControlWrapper(CanvasControl canvasControl)
//-----------------------------------------------------------------------
// <copyright file="SwaggerMiddleware.cs" company="NSwag">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license>
// <author>Rico Suter, mail@rsuter.com</author>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
log.LogError(exception, w => w
.WriteProperty("action", "HandleCommand.")
.WriteProperty("actionId", context.ContextId.ToString())
.WriteProperty("state", "Failed")
.WriteProperty("commandType", context.Command.GetType().Name));
log.LogError($"Failed to handle command {context.Command.GetType().Name}.");
public class ActionContextLogAppender : ILogAppender
{
private readonly IActionContextAccessor actionContextAccessor;
public ActionContextLogAppender(IActionContextAccessor actionContextAccessor)
{
this.actionContextAccessor = actionContextAccessor;
}
public void Append(IObjectWriter writer)
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class MinifyHtmlAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
if (IsSupportedContentType(filterContext))
{
filterContext.HttpContext.Response.Filter = new MinifyHtmlStream(filterContext.HttpContext.Response.Filter);
}
}
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace GP.Utils.Mathematics
{
/// <summary>
/// Defines a convex hull that can be constructed from multiple vectors.
/// </summary>
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample server Petstore server.\nYou can find out more about Swagger at\n[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n# Introduction\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team.\nIt was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo)\ntool and [ReDoc](https://github.com/Rebilly/ReDoc) documentation. In addition to standard\nOpenAPI syntax we use a few [vendor extensions](https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md).\n# OpenAPI Specification\nThis API is documented in **OpenAPI format** and is based on\n[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io