Skip to content

Instantly share code, notes, and snippets.

View Hallmanac's full-sized avatar

Brian Hall Hallmanac

View GitHub Profile
public static class ImageMiddlewareExtensions
{
public static IApplicationBuilder
UseImageMiddleware(this IApplicationBuilder builder, string path)
{
builder.UseMiddleware(typeof(ImageMiddleware), path);
return builder;
}
}
public class ImageMiddleware
{
private readonly RequestDelegate _next;
private readonly string _path;
public ImageMiddleware(RequestDelegate next, string path)
{
_next = next;
this._path = path;
}
@Hallmanac
Hallmanac / AllUsStates.cs
Last active April 28, 2017 21:01
A C# class holding constants of all US States surfaced as an object named UsState
using System.Collections.Generic;
using System.Linq;
namespace Hallmanac
{
public class AllUsStates
{
public static UsState Alabama { get; } = new UsState("a1103958-42c9-4fda-ab46-a04d41a4783b", 1, "Alabama", "AL");
public static UsState Alaska { get; } = new UsState("afa95187-e5a6-44c6-baf2-0dbb3dcc93b1", 2, "Alaska", "AK");
public static UsState Arizona { get; } = new UsState("c090438e-5f7f-427f-a191-d6ea1be8185b", 3, "Arizona", "AZ");
@johnpapa
johnpapa / constant injector thing.js
Last active July 27, 2016 11:01
angular.bootstrap
angular.element(document).ready(bootstrapper);
// to boostrap you need to remove ng-app="app"
function bootstrapper() {
var initInjector = angular.injector(['ng']);
var someval = 'some id'; // here is what you would write in node
// or
// $http call to go get the value
//var $http = initInjector.get('$http');