Skip to content

Instantly share code, notes, and snippets.

@lichenbuliren
lichenbuliren / vagrant-homestead-php7-redis.sh
Created April 12, 2017 10:26 — forked from aNd1coder/vagrant-homestead-php7-redis.sh
Installing PHP REDIS PHP7 Branch On Fresh Install Homestead PHP7 Branch
vagrant@homestead:~$ sudo apt-get update
vagrant@homestead:~$ git clone -b php7 https://github.com/phpredis/phpredis.git
vagrant@homestead:~$ sudo mv phpredis/ /etc/
vagrant@homestead:~$ cd /etc/phpredis
vagrant@homestead:/etc/phpredis$ phpize
vagrant@homestead:/etc/phpredis$ ./configure
vagrant@homestead:/etc/phpredis$ make && make install
# Note This is an Extension You Need to Enable to Make it Work in Php 7
# This First Command Will Allow You To Call PHPREDIS Facade in Browser
@lichenbuliren
lichenbuliren / throttle.js
Created March 10, 2017 03:40
函数节流方法
/**
* 函数节流实现
* @param {Function} fn 需要节流执行的函数
* @param {[type]} interval 事件执行间隔时间,单位 ms
* @return {[type]} [description]
*/
var throttle = function(fn, interval) {
var _self = fn,
timer,
firstTime = true;
@lichenbuliren
lichenbuliren / text-3d.scss
Created March 8, 2017 09:28
文字 3D 立体效果
@mixin text-3d($color: white, $depth: 5) {
$shadows: ();
$shadow-color: $color;
@for $i from 1 through $depth {
$shadow-color: darken($shadow-color, 10%);
$shadows: append($shadows, 0 ($i * 1px) $shadow-color, comma);
}
color: $color;
@lichenbuliren
lichenbuliren / index.js
Created February 17, 2017 08:09
得到某个区间的字母组成的数组
function getArrForAlphabet(startLetter, endLetter) {
//var regExp = /^[a-zA-Z]$/gi;
var regExp = new RegExp("^[a-zA-Z]$");
if (!regExp.test(startLetter) || !regExp.test(endLetter)) {
//console.log(regExp.test(startLetter));
//console.log(regExp.test(endLetter));
console.log('请传入字母!');
return false;
};
//i是得到开始字母的数字表示,j得到结束字母的数字表示
@lichenbuliren
lichenbuliren / hack.html
Created February 9, 2017 06:35
hack 处理微信识别二维码图片问题
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<img src="base64:xxxxx" class="hack-qcode"/>
</body>
</html>
@lichenbuliren
lichenbuliren / img.css
Created February 8, 2017 06:21
美化图片加载失败样式
img {
/* Same as first example */
min-height: 50px;
}
img:before {
content: " ";
display: block;
position: absolute;
@lichenbuliren
lichenbuliren / _tint-and-shade.scss
Created January 8, 2017 09:57
Tint and Shade functions for Sass
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}
@lichenbuliren
lichenbuliren / hack.js
Created January 4, 2017 09:47
一些 js 小技巧
// 保留两位数字符
const twoDigits = (num) => ('0' + num).slice(-2);
@lichenbuliren
lichenbuliren / index.css
Created December 26, 2016 02:23
移动端 IOS 滑动问题
iOS 下原生内容滚动比较卡可以给容器添加下面 CSS 属性:
-webkit-overflow-scrolling: touch;
@lichenbuliren
lichenbuliren / introrx.md
Created November 24, 2016 07:39 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing