2018年10月

手机点击图片显示蓝色区域 bootstrap点击阴影modal模态框不消失

*{
    -webkit-tap-highlight-color: rgba(255,0,0,0);
    -webkit-appearance:none;
}    

//在样式里面加个这个就会没有蓝色的区域

bootstrap点击阴影模态框不消失

  1. 模态框添加data-backdrop="static"
  2. 调用 $("#myModal").modal({backdrop:'static',keyboard:false});
    backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
    keyboard 为 false 时,按下 Esc 键不会关闭 Modal。

git 常用操作

  1. 全局配置
    git config --global user.name "hitortoise"
    git config --global user.email "yzhsh89@126.com"
  2. 生成密钥
    ssh-keygen -t rsa -C"yzhsh89@126.com"
  3. 服务端添加公钥
    vim ~/.ssh/authorized_keys
  4. 创建裸仓库
    git init --bare sample.git
    chown -R git:git sample.git
  5. 克隆
    git clone git@server:/srv/sample.git
  6. git不能显示中文
    git config --global core.quotepath false

MySql 百千万级别数据中随机获取一条或多条记录之RAND()优化

最近所做读书小程序中需从千万条数据中随机抽取一条名言语录展示,常规的select * from famous order by RAND() LIMIT 1;,缺少索引及全表扫描,速度异常慢。
SELECT * FROM famous AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM famous)-(SELECT MIN(id) FROM famous))+(SELECT MIN(id) FROM famous)) AS id) AS t2 WHERE t1.id >= t2.id ORDER BY t1.id LIMIT 1;