Skip to content

Instantly share code, notes, and snippets.

[RoutePrefix("api/my")]
public class MyController : ApiController
{
[AllowAnonymous]
[Route("anon")]
public IHttpActionResult Get() => Ok(User);
[Route("auth")]
public IHttpActionResult GetAuth() => Ok(User);
}
using System;
using System.Collections.Generic;
using System.Text;
namespace GIS
{
public class Utility
{
/// <summary>
@joncloud
joncloud / Content.mgcb
Last active February 2, 2017 03:57
SpriteFont macos Issue
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False
@joncloud
joncloud / Game1.cs
Created January 17, 2017 02:19
MonoGame + Console
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace ConsoleIdea
{
/// <summary>
@joncloud
joncloud / LogException.cs
Created January 11, 2017 15:57
Logging Idea
private class LogException : Exception
{
private readonly object[] _arguments;
private readonly Level _level;
private readonly string _message;
private readonly Type _type;
private LogException(Type type, Level level, string message, object[] arguments)
{
_arguments = arguments;
@joncloud
joncloud / 01-Results.md
Last active January 9, 2017 16:01
FormUrlEncodedContent
BenchmarkDotNet=v0.10.1, OS=Windows
Processor=?, ProcessorCount=8
Frequency=2435779 Hz, Resolution=410.5463 ns, Timer=TSC
dotnet cli version=1.0.0-preview2-003131
  [Host]     : .NET Core 4.6.24628.01, 64bit RyuJIT
  DefaultJob : .NET Core 4.6.24628.01, 64bit RyuJIT
@joncloud
joncloud / Shared.cs
Created January 6, 2017 00:04
Shared
static Task<IActionResult> InvokeGet(string key, ApplicationRedirect applicationRedirect) {
var service = Substitute.For<IApplicationService>();
service.FindAsync(key).Returns(applicationRedirect);
var applicationController = new ApplicationsController(service);
return applicationController.Get(key);
}
@joncloud
joncloud / Constructor.cs
Created January 5, 2017 16:53
ASP.NET Core Services
[Route("api/applications")]
public class ApplicationsController : Controller
{
private IApplicationService applicationService;
public ApplicationsController(IApplicationService applicationService)
{
this.applicationService = applicationService;
}
[HttpGet("{key}")]
public async Task<IActionResult> Get(string key)
@joncloud
joncloud / 01-Summary.md
Last active December 9, 2016 15:31
JWT Perf
BenchmarkDotNet=v0.10.1, OS=Windows
Processor=?, ProcessorCount=8
Frequency=2435775 Hz, Resolution=410.5470 ns, Timer=TSC
dotnet cli version=1.0.0-preview2-003131
  [Host]     : .NET Core 4.6.24628.01, 64bit RyuJIT
  DefaultJob : .NET Core 4.6.24628.01, 64bit RyuJIT

Method | Mean | StdErr | StdDev | Gen 0 | Allocated |

@joncloud
joncloud / perf.js
Last active December 6, 2016 15:01
(function (total) {
times = []
function time(name, fn) {
var t0 = performance.now();
fn();
var t1 = performance.now();
times.push(name + " took " + (t1 - t0));
}