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
// jscs 配置文件 | |
{ | |
disallowAnonymousFunctions: true, // 不允许匿名函数 | |
disallowCapitalizedComments: true, // 不允许注释首字符大写 | |
disallowCommaBeforeLineBreak: true, // 不允许逗号出现在换行符之前 | |
disallowCurlyBraces: true, // 不允许语句后面出现不必要的大括号 | |
disallowDanglingUnderscores: true, // 除特殊内置变量外,不允许变量名是下划线开头或结尾的 | |
disallowEmptyBlocks: true, // 除 try catch 外,不允许空语句块 | |
disallowFunctionDeclarations: true, // 不允许声明函数 |
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 webpack = require('webpack'); | |
var path = require('path'); | |
var bower_dir = path.join(__dirname, 'bower_components'); | |
var node_modules_dir = path.join(__dirname, 'node_modules'); | |
var spm_dir = path.join(__dirname, 'spm_modules'); | |
var config = { | |
addVendor: function (name, path) { | |
this.resolve.alias[name] = path; | |
this.module.noParse.push(path); |
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
// jQuery 1.7.2- removeEvent 的代码 | |
function( elem, type, handle ) { | |
if ( elem.detachEvent ) { | |
elem.detachEvent( "on" + type, handle ); | |
} | |
}; | |
// jQuery 1.8.0+ removeEvent 的代码 | |
function( elem, type, handle ) { | |
var name = "on" + type; |
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
$ more ~/.ssh/config | |
Host github.com_ls | |
HostName github.com | |
User lizziesky@gmail.com // 邮箱或者账户名 | |
IdentityFile ~/.ssh/id_rsa_ls | |
Host github.com | |
HostName github.com | |
User shengyan1985@gmail.com | |
IdentityFile ~/.ssh/id_rsa |
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 getCommonAncestor(nodes) { | |
if (!nodes || !nodes.length) { | |
return null; | |
} | |
else if (nodes.length == 1) { | |
return nodes[0].parentNode; | |
} else { | |
var p = nodes[0], | |
pass = 0; | |
while (!pass && p != document.body) { |
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 isEmptyObject(o) { // jQuery | |
var name; | |
for (name in o) { | |
return false; | |
} | |
return true; | |
} | |
function isEmptyObject(o) { // KISSY |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Test Each</title> | |
<script src="http://assets.spmjs.org/seajs/seajs/2.0.0/sea.js"></script> | |
</head> | |
<body> | |
<script> |
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 PubSub = { | |
subscribe: function(ev, callback) { | |
var calls = this._callbacks || (this._callbacks = {}); | |
(this._callbacks[ev] || (this._callbacks[ev] = [])).push(callback); | |
return this; | |
}, | |
publish: function() { | |
var args = Array.prototype.slice.call(arguments, 0); |
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
window.location.hash = "something"; | |
$(window).bind("hashchange", function() { | |
// do sth. | |
}); |
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
if (!Function.prototype.bind) { | |
Function.prototype.bind = function (obj) { | |
var slice = [].slice, | |
args = slice.call(arguments, 1), | |
self = this, | |
nop = function () {}, | |
bound = function () { | |
return self.apply( this instanceof nop ? this: (obj || {}), args.concat(slice.call(arguments))); | |
}; |