// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// ==/ClosureCompiler==
function xx() {
function hello(name) {
alert('Hello, ' + name);
}
eval('(hello("New user"))')
This file contains hidden or 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
[ | |
'{{repeat(5, 7)}}', | |
{ | |
id: '{{index}}', | |
guid: '{{guid}}', | |
isActive: '{{bool}}', | |
balance: '{{numeric(1000,4000,%=$0,0.00)}}', | |
picture: 'http://placehold.it/32x32', | |
age: '{{numeric(20,40)}}', | |
name: '{{firstName}} {{surname}}', |
This file contains hidden or 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
for (var i = 0; a < 3; i++) { | |
setTimeout(function() { | |
console.log(a); | |
}, 0); | |
}; | |
// 控制台中的输出结果是什么? |
This file contains hidden or 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
// oldj:设 A = $("#id a"),B = $("#id .c a"),求 A - B。要求: | |
// 1、不能用 jQuery 等框架; | |
// 2、兼容 IE6 在内的各大浏览器; | |
// 3、尽可能高效; | |
// 4、尽可能简短。 | |
function getWanted() { | |
var root = document.getElementById('id') | |
var all = root.getElementsByTagName('*') |
朴灵的 EventProxy, README 里有个例子:
var proxy = new EventProxy();
var render = function (template, data, l10n){
_.template(template, data);
};
proxy.assign("template", "data", "l10n", render);
$.get("template", function (template) {
// something
This file contains hidden or 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
<script> | |
;(function(d, s, c, n, h) { | |
c = d.getElementsByTagName(s); | |
c = c[c.length - 1]; c.id = "t-a-{pid}"; | |
n = d.createElement(s); | |
n.async = 1; | |
n.src = 'http://{host}/{path}?i={pid}'; | |
h = d.getElementsByTagName('head')[0]; | |
if(h) h.insertBefore(n, h.firstChild); | |
})(document, 'script'); |
This file contains hidden or 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
/** | |
* modified from http://gist.github.com/527683 | |
* only improve slightly to get small | |
*/ | |
var ie = function(v, p, needle, undef) { | |
needle = p.getElementsByTagName('br'); | |
while( | |
p.innerHTML = '<!--[if gt IE ' + (++v) + ']><br><![endif]-->', |