This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class UrlHelperExtensions | |
{ | |
public static string SmartAction(this UrlHelper url, object values) | |
{ | |
return SmartAction(url, null, values); | |
} | |
public static string SmartAction(this UrlHelper url, RouteValueDictionary valueCollection) | |
{ | |
return SmartAction(url, null, valueCollection); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loader = require('../path/to/link'); | |
loader.alias('package', '../path/to/package.js'); | |
loader.alias('package2', '../path/to/package2.js'); | |
loader.base('../path/to/my/root/folder/'); | |
loader.load('main'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentInstance; | |
function parent(){ | |
currentInstance.parent(); | |
} | |
function wrapMethod(method){ | |
return function(){ | |
var previousInstance = currentInstance; | |
currentInstance = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deferred Labeled Modules.js | |
require: 'Foo'; | |
function LoadSomething(){ | |
var a = 'A'; // Synchronous | |
alert('Will now start loading the Foo module'); | |
defer: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var a, b, c; | |
function A(){ | |
if (a) return a; | |
var exports = a = {}; | |
var n = 'foo'; | |
var x = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function require(module){ | |
if (module.cached) return module.cached; | |
module(module.cached = {}); | |
return module.cached; | |
}; | |
function MODULE1(exports){ | |
}; | |
function MODULE2(exports){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module M { | |
function B(){ return 'B'; }; | |
export this A(){ A = B; return 'A'; }; | |
} | |
M(); // 'A' | |
M(); // ? | |
// If the second call yields 'B' then this should be ok as well: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = function(html){ | |
var root = document.createElement('root'); | |
root.innerHTML = html; | |
var nodes = root.getElementsByTagName('*'), ids = {}; | |
for (var i = 0, l = nodes.length; i < l; i++){ | |
var id = nodes[i].getAttribute('id'); | |
if (id){ | |
nodes[i].removeAttribute('id'); | |
ids[id] = i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setCurrentGlobalState('foo'); | |
throw E; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseCSStransform(transform){ | |
var result = new ART.Transform(), tranform, | |
commandMatcher = /(\w+)\(([^\)]*)\)/g, command, | |
paramMatcher = /([\d\.]+)/g, params; | |
while (command = commandMatcher.exec(transform)){ | |
params = command[2].match(paramMatcher); | |
for (var i = 0; i < params.length; i++) | |
params[i] = parseFloat(params[i]); | |
transform = new ART.Transform(); | |
transform[command[1]].apply(transform, params); |