Skip to content

Instantly share code, notes, and snippets.

@spooky
spooky / StringCOncatTest.cs
Created April 20, 2012 08:35
Simple performance test for string concatenation operations
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace StringConcat
{
class Program
{
private static int noLoops = 100000;
html,body {
height:100%;
}
body {
background-image:url(img/Background.png);
background-repeat:repeat;
margin:0;
font-family:Georgia;
}
@spooky
spooky / site.less
Created October 8, 2012 13:21
quick less version of site.css
@link-color: #bca36c;
@hover-color: #004263;
@disabled-color: #bbb;
@text-color: #333;
html, body {
height:100%;
}
body {
@spooky
spooky / site.scss
Created October 8, 2012 13:22
quick sass version of site.css - using the scss syntax
$link-color: #bca36c;
$hover-color: #004263;
$disabled-color: #bbb;
$text-color: #333;
html {
height: 100%;
}
body {
@spooky
spooky / site.styl
Created October 8, 2012 13:24
quick stylus version of site.css - using the vervbose syntax
link-color = #bca36c;
hover-color = #004263;
disabled-color = #bbb;
text-color = #333;
html {
height:100%;
}
body {
@spooky
spooky / rebundler
Created December 10, 2012 14:41
a hack to make mvc4 bundling work with mvc contrib portable areas
public class Rebundler
{
private readonly Assembly assembly;
private readonly string virtualPath;
private readonly HashSet<string> resourceNames = new HashSet<string>();
public Rebundler(Assembly assembly, string virtualPath)
{
this.assembly = assembly;
this.virtualPath = virtualPath;
@spooky
spooky / EmbededResourceBundle
Created December 10, 2012 14:50
allows using embeded resources for bundling
public abstract class EmbededResourceBundle : Bundle
{
private Assembly assembly;
private readonly HashSet<string> resourceNames = new HashSet<string>();
private readonly string contentType;
public EmbededResourceBundle(Assembly assembly, string virtualPath, string contentType, params IBundleTransform[] transforms) : base(virtualPath, null, transforms)
{
this.assembly = assembly;
this.contentType = contentType;
@spooky
spooky / EmbededScriptBundle
Created December 10, 2012 14:51
for using embeded scripts in bundles
public class EmbededScriptBundle : EmbededResourceBundle
{
public EmbededScriptBundle(Assembly assembly, string virtualPath) : base(assembly, virtualPath, "text/javascript", new JsMinify())
{
ConcatenationToken = ";";
}
}
@spooky
spooky / EmbededStyleBundle
Created December 10, 2012 14:52
for using embeded scripts in bundles
public class EmbededStyleBundle : EmbededResourceBundle
{
public EmbededStyleBundle(Assembly assembly, string virtualPath) : base(assembly, virtualPath, "text/css", new CssMinify())
{
}
}
@spooky
spooky / Assets
Created December 10, 2012 15:00
Used to render embeded resources
public class Assets
{
private static IBundleResolver resolver;
internal static IBundleResolver Resolver
{
get { return resolver ?? BundleResolver.Current; }
set { resolver = value; }
}
private static IHtmlString RenderTag(string template, params string[] attributes)