2018-05-07 23:33:09   Visit  14

npm 降级

npm i npm@4 -g

npm 淘宝镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org
2018-04-17 12:28:09   Visit  30

现有的服务器(centos7.5)使用yum install nodejs 命令默认安装的是nodejs6。

curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
yum install nodejs -y
2018-04-16 23:59:29   Visit  36

设置nodejs全局安装路径

npm config set prefix \\\"D:\\\\Program Files\\\\nodejs\\\\node_global\\\"
npm config set cache \\\"D:\\\\Program Files\\\\nodejs\\\\node_cache\\\"

查看nodejs全局安装路径

 npm config get prefix

把node_global路径添加到系统的环境变量中

2018-04-02 19:27:46   Visit  61

设置浏览器滚动条样式

 ::-webkit-scrollbar-track-piece {
    background-color: #fff;
    -webkit-border-radius: 0
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px
}

::-webkit-scrollbar-thumb {
    height: 50px;
    background-color: #b8b8b8;
    -webkit-border-radius: 6px;
    outline: 2px solid #fff;
    outline-offset: -2px;
    border: 2px solid #fff;
    filter: alpha(opacity=50);
    -moz-opacity: 0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5
}

::-webkit-scrollbar-thumb:hover {
    height: 50px;
    background-color: #878987;
    -webkit-border-radius: 6px
}
2018-03-29 16:43:16   Visit  42

nginx指向本地目录

访问 www.domain.com/file/ 的时候就会访问到本地F盘下的upload目录下的文件,而不是upload/file下的文件

location /file{
            root F:/upload/; 
            rewrite \'^/file(.*)$\' $1 break; 
}
2018-03-29 13:15:58   Visit  54

授权文件夹权限给用户

chown -R postgres leechgtablespace/

查找进程

ps -aux |grep nginx
2018-03-29 12:47:05   Visit  50

Freemarker

Freemarker中输出long类型带千位分隔符,也就是逗号。
需要把long类型转换为字符串,就可以正常输出完整的数字。

${totalCount?c}
2018-03-14 10:14:58   Visit  690

配置catalina.sh

# chkconfig: 112 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.6.0_23/
CATALINA_HOME=/usr/local/tomcat

复制catalina.sh到init.d目录

cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat8

注册到服务

chmod 755 /etc/init.d/tomcat8
chkconfig --add tomcat8
chkconfig tomcat8 on

启动服务

service tomcat8 start
Starting tomcat8 (via systemctl):                          [  OK  ]
2018-03-13 22:16:55   Visit  61

安装MySQL

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

yum install -y mysql-server mysql mysql-devel 
2018-03-07 18:20:23   Visit  97

JS事件类及继承

Lee = window.Lee||{};

Lee.Events =  function(){
    this.ets = this.ets||{};
    console.log(\\\\\\\"init Events\\\\\\\");
};
Lee.Events.prototype.on = function(name, fun){
    this.ets = this.ets||{};
    if(typeof(name)==\\\\\\\"string\\\\\\\"){
        this.ets[name] = this.ets[name]||[];
        this.ets[name].push(fun);
        fun.eventonce = false;
    }
    else{
        for(var id in name){
            this.on(id, name[id]);
        } 
    }
    return this;
};

Lee.Events.prototype.bind = Lee.Events.prototype.on;

Lee.Events.prototype.once = function(name, fun){
    this.ets = this.ets||{};
    if(typeof(name)==\\\\\\\"string\\\\\\\"){
        this.ets[name] = this.ets[name]||[];
        this.ets[name].push(fun);
        fun.eventonce = true;
    }
    else{
        for(var id in name){
            this.on(id, name[id]);
        } 
    }
    return this;
};

Lee.Events.prototype.off = function(name, fun){
    this.ets = this.ets||{};
    if(!name){
        this.ets = {};
    }
    else if(!fun){
        this.ets[name] = [];
    }
    else{
        var funs = this.ets[name];
        if(funs){
            for(var i =0;i<funs.length;i++){
                if(funs[i] == fun){
                    this.ets[name] = funs.splice(i, 1);
                    break;
                }
            }
        }
    }
    return this;
}
Lee.Events.prototype.unbind = Lee.Events.prototype.off;

Lee.Events.prototype.fire = function(name, data, propagate){
    this.ets = this.ets||{};
    if(name&&this.ets[name]){
        var funs = [];
        for(var i=0;i<this.ets[name].length; i++){
            var fun = this.ets[name][i]; 
            fun.apply(this, [data]);
            if(!fun.eventonce){
                funs.push(fun);
            }
        }
        this.ets[name] = funs;
    }
    return this;
}
//继承
Lee.ExtentClass = function(A, B){
    var Super = function(){};
    Super.prototype = B.prototype;
    var s = new Super();
    for(var id in s){
        A.prototype[id] = s[id];
    }
    //A.prototype = s;
    A.constructor = A;
    A.prototype.super = function(){
        Super.prototype.constructor.apply(this);
    }
    return A;
}

Lee.ClassTest = function(){
    
}
Lee.ExtentClass(Lee.ClassTest, Lee.Events);
Lee.ClassTest.prototype.say = function(){
    alert(\\\\\\\"hi\\\\\\\")
}