Skip to content

Instantly share code, notes, and snippets.

View ediblecode's full-sized avatar

Ian Routledge ediblecode

View GitHub Profile
@jonathantneal
jonathantneal / README.md
Created September 19, 2012 06:34
Polyfill the EventListener interface in IE8

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

@benfoster
benfoster / gist:3274578
Created August 6, 2012 13:51
Enforcing lower case routes in ASP.NET Web Api
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints: new { url = new LowercaseRouteConstraint() }
);
@markembling
markembling / hosts.ps1
Created August 24, 2009 13:38
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {