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
# remove node_modules in floder | |
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + | |
# rename | |
rename -d "Typescript" ./ |
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
#!/bin/sh | |
# | |
# chkconfig: 2345 55 25 | |
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx | |
# For Debian, run: update-rc.d -f nginx defaults | |
# For CentOS, run: chkconfig --add nginx | |
# | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all |
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
# 注册模块镜像 | |
registry=https://registry.npmmirror.com | |
# node-gyp 编译依赖的 node 源码镜像 | |
disturl=https://npmmirror.com/mirrors/node/ | |
# chromedriver | |
chromedriver_cdnurl=https://cdn.npmmirror.com/binaries/chromedriver/ | |
# operadriver |
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
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with 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
// 验证身份证号码 | |
function verify_id_card(value) { | |
// 转换字母为大写,增加大小写X的容错能力 | |
var id_card = value.toUpperCase(); | |
//检查号码是否符合规范,包括长度,类型 | |
var isCardNo = function(obj) { | |
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X | |
var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/; | |
if (reg.test(obj) === false) { |
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 toThousands(num) { | |
var result = [ ], counter = 0; | |
num = (num || 0).toString().split(''); | |
for (var i = num.length - 1; i >= 0; i--) { | |
counter++; | |
result.unshift(num[i]); | |
if (!(counter % 3) && i != 0) { result.unshift(','); } | |
} | |
return result.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
/** | |
* [validate_card_luhn Luhn算法检验卡号] | |
* | |
* @param {String} card_number [需要检验的卡号] | |
* @return {Boolean} | |
* | |
* @via https://zh.wikipedia.org/wiki/Luhn%E7%AE%97%E6%B3%95 | |
* @author tonyc726 | |
*/ | |
function validate_card_luhn(card_number){ |
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 digitUppercase = function(n) { | |
var fraction = ['角', '分']; | |
var digit = [ | |
'零', '壹', '贰', '叁', '肆', | |
'伍', '陆', '柒', '捌', '玖' | |
]; | |
var unit = [ | |
['元', '万', '亿'], | |
['', '拾', '佰', '仟'] | |
]; |
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 color(){ | |
return '#' + Math.floor(0x1000000 + Math.random() * 0x1000000).toString(16).slice(1); | |
} |
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://www.imooc.com/wenda/detail/4603 | |
var EventUtil = { | |
getEvent: function (e) { | |
return e || window.event; | |
}, | |
getTarget: function (e) { | |
return e.target || e.srcElement; |
NewerOlder