Skip to content

Instantly share code, notes, and snippets.

@kentaromiura
kentaromiura / gist:132065
Created June 18, 2009 18:01
Global.asax.cs
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" }
@kentaromiura
kentaromiura / LessController.cs
Created June 18, 2009 18:21
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 {
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Show.aspx.cs" Inherits="MvcApplication1.Views.Home.Show" %>
<%= ViewData["Css"] %>
<%@ 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>
@kentaromiura
kentaromiura / test1.less
Created June 18, 2009 18:30
test1.less
/* LESS */
@brand_color: #4D926F;
@other_color: rgb(166,255,122);
.common-rules{
border:1px solid silver;
}
.font-rules{
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;
Function.implement('Invoke',
function(args){
var tmp = Class.instantiate(this);
var init = this.prototype.initialize;
if(init){
init.apply(tmp,$splat(args));
}
return tmp;
});
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};
},
<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(){
<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);