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 EventEmitter = require('events').EventEmitter | |
, proto = require('./proto') | |
, utils = require('./utils') | |
, path = require('path') | |
, basename = path.basename | |
, fs = require('fs'); | |
//应用补丁,封装了一些方法 | |
require('./patch'); |
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 Q = require('q') | |
var _ = require('underscore') | |
var exec = require('child_process').exec | |
var path = require('path') | |
var fs = require('fs') | |
//模拟Express App: `get`、`set` | |
var app = { | |
_data:{}, | |
get: function(key){ |
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
/* Structs2的对象序列化 | |
* | |
* Example: | |
* {a:'a', b:[{c:'c'}, {d:'d'}]} | |
* | |
* => {'a':'a', 'b[0].c': 'c', 'b[1].d': 'd'} | |
* | |
*/ | |
function flattern(o) { | |
var result = {}; |
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
/** | |
* 把key不带引号的JSON字符串转换为JSON对象 | |
* | |
* Example: | |
* '{a:1,b:"b",c:{arr:[{name:"n1",title:"t1"},{name:"n2",title:"t2"}]}}' | |
*/ | |
function parse(s) { | |
s = addQuota(s); | |
function addQuota(s) { |
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
# 如果cairo是通过homebrew安装的,那么在~/.bashrc或者~/.zshrc里加入以下配置 | |
# https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX#installing-cairo | |
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | |
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig |
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
ssh-keygen -f ~/.ssh/known_hosts -R gitlab.xxx.com |
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 benchmarks = require('beautify-benchmark'); | |
var Benchmark = require('benchmark'); | |
var mysql = require('mysql'); | |
var pool = mysql.createPool({ | |
host: 'x.x.x.x', | |
port: 8888, | |
user: 'test', | |
database: 'test_db', | |
password: '123456', |
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
"folding settings | |
set foldmethod=indent "fold based on indent | |
set foldnestmax=10 "deepest fold is 10 levels | |
set nofoldenable "dont fold by default | |
set foldlevel=1 "this is just what i use | |
"NERDTree show hidden files | |
let NERDTreeShowHidden=1 | |
"convert tab to spaces" |