Skip to content

Instantly share code, notes, and snippets.

View seangwright's full-sized avatar
🐻
Still learning...

Sean G. Wright seangwright

🐻
Still learning...
View GitHub Profile
@seangwright
seangwright / Startup.cs
Last active June 1, 2016 17:34
Startup.cs
using Microsoft.Owin;
using Microsoft.Owin.Extensions;
using Owin;
using System.Web;
using System.Web.Http;
using System.Web.SessionState;
using WiredViews.WIR03.Web.Api.Configuration;
[assembly: OwinStartup(typeof(WiredViews.WIR03.Web.Api.Startup))]
@seangwright
seangwright / WebApiModule.cs
Created April 24, 2016 02:49
WebApiModule.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CMS.DataEngine;
using System.Web.Http;
namespace WiredViews.AQU04.Web.Api.Kentico
{
@seangwright
seangwright / WebApiModuleMetadata.cs
Created April 24, 2016 02:50
WebApiModuleMetadata.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CMS.Core;
namespace WiredViews.AQU04.Web.Api.Kentico
{
/// <summary>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
@seangwright
seangwright / ValueController.cs
Created April 25, 2016 18:51
ValueController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
namespace WiredViews.WIR03.Web.Api.Controllers
{
@seangwright
seangwright / all-styles.css
Created March 4, 2017 17:49
nginx domain specific css configuration
// branda.local/styles.css
p {
color: red;
}
// brandb.local/styles.css
p {
color: blue;
}
@seangwright
seangwright / KebabRoutingConvention.cs
Created July 13, 2017 01:51
AspNet Core MVC attribute routing lower/kebab case controller placeholder replacement
/**
Takes something like this
[Route("api/customer/{customerId:int}/[controller]")]
public class SpecialOrderController : Controller
{
// ...
[HttpGet("~/api/[controller]")]
[Produces(typeof(IEnumerable<SpecialOrderResponse>))]
@seangwright
seangwright / click-stop-or-prevent.directive.ts
Created August 13, 2018 15:31
Vue-js style click event modifiers directive for Angular
import { Directive, ElementRef, EventEmitter, OnInit, Output, Renderer2 } from '@angular/core';
/**
* Sourced from https://netbasal.com/implementing-event-modifiers-in-angular-87e1a07969ce
*/
@Directive({
selector:
// tslint:disable-next-line:directive-selector
'[click.stop],[click.prevent],[click.stop.prevent],[click.prevent.stop]',
})
@seangwright
seangwright / ienvironment.ts
Created August 18, 2018 03:03
blog-best-way-to-use-angular-environment--ienvironment.ts
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
export interface IEnvironment {
production: boolean;
// Enables use of ng.profiler.timeChangeDetection(); in browser console
enableDebugTools: boolean;
logLevel: LogLevel;
apiUrl: string;
apiHost: string;
@seangwright
seangwright / environment.ts
Created August 18, 2018 03:05
blog-best-way-to-use-angular-environment--environment.ts
/*
* In development mode, to ignore zone related error stack frames such as
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
* import the following file, but please comment it out in production mode
* because it will have performance impact when throw error
*/
import 'zone.js/dist/zone-error'; // Included with Angular CLI.
import { IEnvironment } from '@environments/ienvironment';