Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View michaelcox's full-sized avatar

Michael Cox michaelcox

View GitHub Profile
@michaelcox
michaelcox / AllowCrossSiteJson.cs
Created February 17, 2012 16:23
Allow Cross Site JSON in .NET MVC
public class AllowCrossSiteJson : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
var headers = Enumerable.ToList(HttpContext.Current.Request.Headers.AllKeys);
headers.Add("X-HTTP-Method-Override");
@michaelcox
michaelcox / FAQ-XSL-Template.xsl
Created February 14, 2011 20:37
XSL Template for saving Frequently Asked Questions as XML, and outputting to HTML.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes" />
<xsl:template match="/faq_page">
<xsl:if test="count(//question) &gt; 5">
<xsl:for-each select="category">