Skip to content

Instantly share code, notes, and snippets.

@brlinton
brlinton / UnityDependencyResolver.cs
Created February 27, 2011 16:31
A unity dependency resolver that demonstrates specific error handling
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Microsoft.Practices.Unity;
namespace MySystem.Ioc
{
public class UnityDependencyResolver : IDependencyResolver
{
public readonly IUnityContainer Container;
using System;
using System.Web.Mvc;
using System.Web.Routing;
namespace MySystem.Ioc
{
public class DependencyInjectionControllerActivator : IControllerActivator
{
public IController Create(RequestContext requestContext, Type controllerType)
{
@brlinton
brlinton / Web Config with Base Razor View.xml
Created May 7, 2011 02:37
Custom View Page Web Config
<configuration>
...
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="MyNamespace.Application.ApplicationViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
@brlinton
brlinton / ApplicationViewPage.cs
Created May 7, 2011 02:40
Sample ViewPage Base
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Web.Mvc;
namespace MyNamespace.Application
{
public abstract class ApplicationViewPage<T> : WebViewPage<T>
{
protected override void InitializePage()
@brlinton
brlinton / ApplicationController.cs
Created May 7, 2011 02:42
Sample Controller Base
using System.Web.Mvc;
using Microsoft.Practices.Unity;
namespace MyNamespace.Application
{
public class ApplicationController : Controller
{
[Dependency]
public ILogger Logger { get; set; }
}
@brlinton
brlinton / _Layout.html
Created February 5, 2012 04:09
A version of the basic MVC3 project layout using Bootstrap from Twitter
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/css/bootstrap.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/css/bootstrap-responsive.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/bootstrap.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
@brlinton
brlinton / gist:4459723
Created January 5, 2013 04:16
jQuery Brogramming
<html>
<head>
</head>
<body>
<a href="#">Click me, bro</a>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('a').click(function(){
@brlinton
brlinton / LogLevelStatsIL.cs
Created March 4, 2013 01:48
An early version of a LogLevelStats class from WoodChipper, but with IL weaving from Fody and Fody.PropertyChanged
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
namespace WoodChipper.Models
{
public class LogLevelStats : INotifyPropertyChanged
{
public virtual int DebugLines
@brlinton
brlinton / FirstXCodeUnitTests.m
Last active January 4, 2016 13:59
The default XCode unit test scaffolding
//
// TipCalculatorTests.m
// TipCalculatorTests
//
// Created by Brandon Linton on 1/25/14.
// Copyright (c) 2014 Brandon. All rights reserved.
//
#import <XCTest/XCTest.h>
@brlinton
brlinton / enable-iis-tools.ps1
Last active June 28, 2021 13:18
Enable IIS tools form the command line
# Remove the /all if you receive any errors
& dism /online /get-features | more
& dism /online /enable-feature /FeatureName:IIS-CertProvider /all
& dism /online /enable-feature /FeatureName:IIS-WindowsAuthentication /all
& dism /online /enable-feature /FeatureName:IIS-ClientCertificateMappingAuthentication /all
& dism /online /enable-feature /FeatureName:IIS-StaticContent /all
& dism /online /enable-feature /FeatureName:IIS-DefaultDocument /all
& dism /online /enable-feature /FeatureName:IIS-WebSockets /all