- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
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
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
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 DONT_ENUM = "propertyIsEnumerable,isPrototypeOf,hasOwnProperty,toLocaleString,toString,valueOf,constructor".split(","); | |
var class2type = {}; | |
"Boolean Number String Function Array Date RegExp Object Error".replace(rword, function(name) { | |
class2type["[object " + name + "]"] = name.toLowerCase() | |
}); | |
//=========================================================================================================// | |
//=========================================================================================================// |
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
/********************************************************************* | |
* ecma262 v5语法补丁 * | |
**********************************************************************/ | |
//-_- 这个trim 测试, 我是不是要 "xuejia".trim | |
if (!"司徒正美".trim) { | |
String.prototype.trim = function() { | |
return this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, '') | |
} | |
} |
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 getCurrentScript(base) { | |
// 参考 https://github.com/samyk/jiagra/blob/master/jiagra.js | |
var stack | |
try { | |
a.b.c() //强制报错,以便捕获e.stack | |
} catch (e) { //safari的错误对象只有line,sourceId,sourceURL | |
stack = e.stack | |
if (!stack && window.opera) { | |
//opera 9没有e.stack,但有e.Backtrace,但不能直接取得,需要对e对象转字符串进行抽取 | |
stack = (String(e).match(/of linked script \S+/g) || []).join(" ") |
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
// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// shim layer with setTimeout fallback | |
(function(){ | |
// chrome shipped without the time arg in m10 | |
var timeundefined = false; | |
if (window.webkitRequestAnimationFrame){ | |
webkitRequestAnimationFrame(function(time){ | |
timeundefined = (time == undefined); |
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
console.memory | |
//MemoryInfo {jsHeapSizeLimit: 793000000, usedJSHeapSize: 10000000, totalJSHeapSize: 29400000} | |
profile('a') | |
//Profile 'a' started. | |
//undefined | |
profileEnd('a') | |
//Profile 'a' finished. | |
//undefined | |
console.profiles |
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 xuejia = { | |
/** | |
* proxy | |
*/ | |
proxy: function(context, func) { | |
return function() { | |
func.apply(context, arguments); | |
} | |
}, | |
/** |
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
/* | |
* Ticker by Grant Skinner. Dec 5, 2010 | |
* Visit http://easeljs.com/ for documentation, updates and examples. | |
* | |
* | |
* Copyright (c) 2010 Grant Skinner | |
* | |
* Permission is hereby granted, free of charge, to any person | |
* obtaining a copy of this software and associated documentation | |
* files (the "Software"), to deal in the Software without |
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 CatGameAssetsManager | |
* | |
* @Fan-outs: Event, DOM | |
*/ | |
KISSY.add('fp-dsf/CatGameAssetsManager', function(S, util) { | |
var CatGameAssetsManager = {}; | |
var imageList = [ |
OlderNewer