Skip to content

Instantly share code, notes, and snippets.

View gist:132065
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
// ...
routes.MapRoute(
"less",
"less.mvc/{action}/{name}.css",
new { controller = "Less", action = "Show" }
View LessController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
namespace MvcApplication1.Controllers {
public class LessController : Controller {
View Show.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Show.aspx.cs" Inherits="MvcApplication1.Views.Home.Show" %>
<%= ViewData["Css"] %>
View Get.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Get.aspx.cs" Inherits="MvcApplication1.Views.Home.Get" %>
<html>
<head>
<link type="text/css" rel="Stylesheet" href="/less.mvc/Show/<%= ViewData["Name"] %>.css"
</head>
<body>
<h1 id="header" name="header"> This is the less source:</h1>
<pre>
<%= ViewData["Less"] %>
</pre>
View test1.less
/* LESS */
@brand_color: #4D926F;
@other_color: rgb(166,255,122);
.common-rules{
border:1px solid silver;
}
.font-rules{
View Swap vs RealSwap.cs
using System;
using System.Collections.Generic;
using System.Text;
public class MyClass
{
public static void Swap<T> (T a , T b){
T x = a;
a = b;
b = x;
View Kenta.Function.invoke.js
Function.implement('Invoke',
function(args){
var tmp = Class.instantiate(this);
var init = this.prototype.initialize;
if(init){
init.apply(tmp,$splat(args));
}
return tmp;
});
View Kenta.IOC.js
var IOC = new Class({
initialize:function(){
this.container = {};
},
register:function(id, component, options){
if($type(id) != 'string')throw new Error("No id to register");
if(!$chk(component))throw new Error("No component to register");
var o = options || {type:'singleton'};
this.container[id] = {type:o.type, component:component};
},
View test.htm
<html>
<head>
<title>Sarissa glitch with mootools</title>
<script type="text/javascript" src="sarissa.js"></script>
<script type="text/javascript" src="sarissa_ieemu_xpath.js"></script>
<script type="text/javascript" src="mootools-1.2.4-core-nc.js"></script>
<script type="text/javascript">
addEvent('domready',function(){
View Mootools.$type.and.ActiveXObject.htm
<html>
<head>
<title>Mootools $type and ActiveXObject</title>
<script type="text/javascript" src="mootools-1.2.4-core-nc.js"></script>
<script type="text/javascript">
addEvent('domready',function(){
var doc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var source = '<root><burp decibel="too much" direction="front of you" save="none"></burp></root>';
doc.async = false;
doc.loadXML(source);
You can’t perform that action at this time.