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 PHP2JSON(phpFilePath) { | |
return new Promise(function(resolve, reject) { | |
childProcess.exec( | |
'php -r \'include("' + phpFilePath + '"); print json_encode($php_object);\'', | |
function(err, stdout, stderr) { | |
if (err) { | |
console.log(err) | |
return | |
} | |
resolve(JSON.parse(stdout)) |
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
# https://github.com/joyent/libuv/blob/master/include/uv.h#L114 | |
E2BIG - "argumentlisttoolong" | |
EACCES - "permissiondenied" | |
EADDRINUSE - "addressalreadyinuse" | |
EADDRNOTAVAIL - "addressnotavailable" | |
EAFNOSUPPORT - "addressfamilynotsupported" | |
EAGAIN - "resourcetemporarilyunavailable" | |
EAI_ADDRFAMILY - "addressfamilynotsupported" | |
EAI_AGAIN - "temporaryfailure" | |
EAI_BADFLAGS - "badai_flagsvalue" |
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /your/root/path; | |
index index.html; | |
server_name you.server.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
# 开放 27017 端口访问 | |
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 27017 -j ACCEPT | |
# 修改 mongod.conf 端口绑定 | |
bindIp: 0.0.0.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
import _ from 'lodash' | |
export function jsonformat(body) { | |
let htmlBlock = '' | |
let space = ' ' | |
let index = 0 | |
let last = false | |
let toString = Object.prototype.toString | |
let self = 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
var flattenObject = function(ob) { | |
var toReturn = {}; | |
for (var i in ob) { | |
if (!ob.hasOwnProperty(i)) continue; | |
if ((typeof ob[i]) == 'object') { | |
var flatObject = flattenObject(ob[i]); | |
toReturn[i] = ob[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
/* 新增字段 */ | |
db.getCollection('collection_name').update({},{$set:{'field_name':'xxx'}},false,true) | |
/* 删除字段 */ | |
db.getCollection('collection_name').update({},{$unset:{'field_name':''}},{multi: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
// https://zizhengwu.github.io/daft-auto-spacing/ | |
var unicode = []; | |
unicode['latin'] = ['[A-Za-z0-9\u00C0-\u00FF\u0100-\u017F\u0180-\u024F\u1E00-\u1EFF]']; | |
unicode['punc'] = ['[@&=_\,\.\?\!\$\%\^\*\-\+\/]', '[\(\\[\'"<‘“]', '[\)\\]\'">”’]']; | |
unicode['hanzi'] = ['[\u4E00-\u9FFF]', '[\u3400-\u4DB5\u9FA6-\u9FBB\uFA70-\uFAD9\u9FBC-\u9FC3\u3007\u3040-\u309E\u30A1-\u30FA\u30FD\u30FE\uFA0E-\uFA0F\uFA11\uFA13-\uFA14\uFA1F\uFA21\uFA23-\uFA24\uFA27-\uFA29]', '[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]', '\uD86D[\uDC00-\uDF3F]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD869[\uDF00-\uDFFF]', '\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]', '[\u31C0-\u31E3]']; | |
unicode['biaodian'] = ['[·・︰、,。:;?!—ー⋯….·/]', '[「『(〔【《〈“‘]', '[」』)〕】》〉’”]']; | |
unicode['zhuyin'] = []; | |
unicode['zhuyin'][0] = '[\u3105-\u312D\u31A0-\u31BA]'; | |
unicode['zhuyin']['shengmu'] = '[\u3105-\u3119\u312A-\u312C\u31A0-\u31A3]'; |
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
sudo /usr/libexec/locate.updatedb |
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
/*================iPhone < 5==================*/ | |
@media screen and (device-aspect-ratio: 2/3) {} | |
/*================iPhone 5==================*/ | |
@media screen and (device-aspect-ratio: 40/71) {} | |
/*================iPhone 6==================*/ | |
@media screen and (device-aspect-ratio: 375/667) {} | |
/*================iPhone 6+==================*/ |
NewerOlder