Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am robertmilne on github.
  • I am robertmilne (https://keybase.io/robertmilne) on keybase.
  • I have a public key whose fingerprint is 2F09 6835 2722 2498 CF23 5F7A 6BB0 092A BB81 7E80

To claim this, I am signing this object:

[RequireScheme(Scheme.Http)]
public partial class MyController : Controller
{
public virtual ActionResult AllowsHttpOnly()
{
return View();
}
[RequireScheme(Scheme.Https)]
public virtual ActionResult AllowsHttpsOnly()
public static class BindingExtensions
{
public static MvcHtmlString Script(this HtmlHelper helper, string innerHtml, Dictionary<string, object> attributes)
{
if (!System.Diagnostics.Debugger.IsAttached)
innerHtml = new Microsoft.Ajax.Utilities.Minifier().MinifyJavaScript(innerHtml);
var builder = new TagBuilder("script");
builder.MergeAttributes(attributes);
builder.InnerHtml = innerHtml;
# if (System.Diagnostics.Debugger.IsAttached) {
<render/>
# } else {
<cache expires="1200">
<content var="styles"><render/></content>
# Response.Write(new Microsoft.Ajax.Utilities.Minifier().MinifyStyleSheet(styles));
</cache>
# }
<content var="styles"><render/></content>
# Response.Write(new Microsoft.Ajax.Utilities.Minifier().MinifyStyleSheet(styles));
using System.Data;
using System.Data.Common;
using MvcMiniProfiler;
using MvcMiniProfiler.Data;
using NHibernate.Driver;
namespace MyProject.Infrastructure
{
public class ProfiledSql2008ClientDriver : Sql2008ClientDriver
{
@robertmilne
robertmilne / ElmahPackage.cs
Created August 2, 2011 22:23
Elmah App_Start
[assembly: WebActivator.PreApplicationStartMethod(typeof(YourNamespace.App_Start.ElmahPackage), "PreStart")]
namespace YourNamespace.App_Start
{
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Elmah;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
@robertmilne
robertmilne / ProfiledSql2008ClientDriver.cs
Created July 27, 2011 19:20
MiniProfiler: NHibernate profiling with batching support
using System.Data;
using System.Data.Common;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using MvcMiniProfiler;
using MvcMiniProfiler.Data;
using NHibernate.Driver;
namespace YourNamespaceHere
{