Skip to content

Instantly share code, notes, and snippets.

View keybase.md

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:

View ElmahPackage.cs
[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 Jul 27, 2011
MiniProfiler: NHibernate profiling with batching support
View ProfiledSql2008ClientDriver.cs
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
{
View ProfiledSql2008ClientDriver.cs
using System.Data;
using System.Data.Common;
using MvcMiniProfiler;
using MvcMiniProfiler.Data;
using NHibernate.Driver;
namespace MyProject.Infrastructure
{
public class ProfiledSql2008ClientDriver : Sql2008ClientDriver
{
View _minifyCSS.spark.xml
<content var="styles"><render/></content>
# Response.Write(new Microsoft.Ajax.Utilities.Minifier().MinifyStyleSheet(styles));
View _minifyCSS.spark.xml
# 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>
# }
View MyController.cs
[RequireScheme(Scheme.Http)]
public partial class MyController : Controller
{
public virtual ActionResult AllowsHttpOnly()
{
return View();
}
[RequireScheme(Scheme.Https)]
public virtual ActionResult AllowsHttpsOnly()
View BindingExtensions.cs
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;