Skip to content

Instantly share code, notes, and snippets.

View Andyliwr's full-sized avatar
🎯
Focusing

月光倾城 Andyliwr

🎯
Focusing
View GitHub Profile
@Andyliwr
Andyliwr / .bash_profile
Created August 29, 2019 07:58
贴一份bash_profile
# 安装keychain ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" && brew install keychain
eval `keychain --eval id_rsa`
# 服务器简称
alias ssh='ssh -A -o ConnectTimeout=3 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias gw1="ssh -A ziling@login1.qima-inc.com"
alias gw2="ssh -A ziling@login2.qima-inc.com"
alias qagw1="ssh -A ziling@login1.qa.qima-inc.com"
alias qagw2="ssh -A ziling@login2.qa.qima-inc.com"
alias tencent="ssh -A ubuntu@118.24.94.40"
@Andyliwr
Andyliwr / verifyPassword.js
Created June 21, 2019 06:43 — forked from yangjunjun/verifyPassword.js
测试密码强度
/**
* 测试密码强度
*
* 1.密码长度为[6-16]位,可以包含数字、字母、特殊符号
* 2.当密码含有一种类型(数字、字母、特殊符号),且长度小于8时,强度为弱;长度大于8时强度为中;
* 3.当密码含有一种类型(数字、字母、特殊符号),且长度小于8时,强度为弱;长度大于8时强度为中;
*/
function verifyPassword(val){
val = val.trim();
@Andyliwr
Andyliwr / common_regex.js
Last active June 21, 2019 06:41
常用正则
// 校验密码包含数字和字母,且长度在6到30个字符
/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,30}$/
// 手机号码加密
'18883339779'.replace(/(\d{3})(\d{4})(\d{4})/, '$1****$3')
// 匹配中文,字母,数字,或者下划线
[a-zA-Z0-9_-/u4e00-/u9fa5]+
@Andyliwr
Andyliwr / debug.js
Last active June 19, 2019 02:39
根据url中的debug参数决定是否加载vconsole
<script>
// 是否加入调试js
if (window.location.search.indexOf('debug=1') > -1) {
let script1 = document.createElement('script');
let script2 = document.createElement('script');
script1.src = '//s.thsi.cn/js/m/kh/page-creator/js/vconsole.min.js';
script2.innerHTML = "var vconsole = new VConsole();";
document.head.appendChild(script1);
script1.onload = () => {
console.log(`已经打开调试`);
@Andyliwr
Andyliwr / linux_common_command.bash
Last active June 11, 2019 01:24
Linux中常用命令
# 查找文件并批量重命名
find . -name "*Editor.js" | xargs rm -f
find . -name "index.js" | xargs rm -f
find . -name "index.js" | xargs rm -f
find . -name "*Preview.js" -exec mv {} index.js \;
# 首行添加一段文字
sed -i '1i/* eslint-disable */' aaa.txt
# 杀死所有node进程
@Andyliwr
Andyliwr / judge_is_directory.js
Created June 5, 2019 12:56
node判断是否为目录
var fs = require('fs');
var stats = fs.statSync("c:\\dog.jpg");
console.log('is file ? ' + stats.isFile());
var stats = fs.statSync("c:\\demo");
console.log('is directory ? ' + stats.isDirectory());
@Andyliwr
Andyliwr / hide_scrollbar.css
Last active June 4, 2019 04:14
隐藏导航栏
.overflow {
/*隐藏滚动条,当IE下溢出,仍然可以滚动*/
-ms-overflow-style: none;
/*火狐下隐藏滚动条*/
overflow-y: auto;
overflow-y: -moz-scrollbars-none;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 0px;
}
@Andyliwr
Andyliwr / generate_random_phone.js
Created June 4, 2019 01:57
随机生成手机号码
const headerNums = new Array("139","138","137","136","135","134","159","158","157","150","151","152","188","187","182","183","184","178","130","131","132","156","155","186","185","176","133","153","189","180","181","177");
const headerNum = headerNums[parseInt(Math.random() * 10 ,10)]
const bodyNum = Math.random().toString().replace('0.', '').slice(0, 8)
console.log(headerNum + bodyNum)
@Andyliwr
Andyliwr / index.html
Created May 3, 2016 09:06
坐标计算
<div class="coordinate_out">
<div id="coordinate">内部</div>
</div>