Skip to content

Instantly share code, notes, and snippets.

View foru17's full-sized avatar
🎯
Focusing

Luo Lei foru17

🎯
Focusing
View GitHub Profile
@foru17
foru17 / background.sh
Created August 17, 2014 15:14
linux后台运行程序
nohup node server.js > /dev/null 2>&1 &
nohup means: Do not terminate this process even when the stty is cut off.
> /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).
2>&1 means: stderr also goes to the stdout (which is already redirected to /dev/null).
& at the end means: run this command as a background task.
@foru17
foru17 / mail-signature
Created August 12, 2014 03:20
邮箱签名
Luo Lei 罗磊
Cheetah mobile | F2E
Mobile: (+86) 186-8882-3265 | QQ: 526020986 | Mail:[email protected]
Fuxing International Center,237 Chaoyang Bei Lu,Chaoyang District,Beijing,100020, China
猎豹移动 | 北京市朝阳区朝阳北路237号复星国际中心20层 猎豹移动(原金山网络) 用户体验部
@foru17
foru17 / scrolEnd.js
Created June 25, 2014 08:36
检测滑动结束
var scrollTimeout = null;
document.addEventListener('scroll',function(event){
clearTimeout(scrollTimeout);
scrollTimeout=setTimeout(function(){
list.newViewedStat();
},100);
})
@foru17
foru17 / checkWechatBroswer.js
Created June 19, 2014 09:47
判断是否是微信内置浏览器的方法
var isWechat=false;
UA=navigator.userAgent.toLowerCase();
if(UA.match(/MicroMessenger/i)=="micromessenger"){
isWechat = true;
}
@foru17
foru17 / bottomRefresh.js
Created June 17, 2014 06:20
滑动到底部自动刷新
var wrap=document.getElementById('page');
var contentHeight=wrap.offsetHeight;
var yOffset=window.pageYOffset;
var y = yOffset + window.innerHeight;
function autoRefesh(){
wrap=document.getElementById('page');
contentHeight=wrap.offsetHeight;
yOffset=window.pageYOffset;
y = yOffset + window.innerHeight;
@foru17
foru17 / textmask.html
Created June 12, 2014 14:01
给文字创造一个渐隐的图层
<style>
.intro{
display: block;
height: 26px;
line-height: 26px;
width: 300px;
overflow: hidden;
position: relative;
}
@foru17
foru17 / base64bgimg.html
Last active August 29, 2015 14:02
在项目中使用Base64 图片为背景
/*
在线转换 http://dopiaza.org/tools/datauri/index.php
比较转换后字符大小 http://bytesizematters.com/
*/
<style>
.dot {
background-image: url(data:image/gif;base64,R0lGODlhBAABAIABAMLBwfLx8SH5BAEAAAEALAAAAAAEAAEAAAICRF4AOw==);
*background-image: url(http://www.zhangxinxu.com/wordpress/wp-content/themes/default/images/zxx_dotted.gif); // IE6~IE7
}
@foru17
foru17 / inserthtml.js
Last active August 29, 2015 14:02
js创建和添加元素
theParent = document.getElementById("theParent");
theKid = document.createElement("div");
theKid.innerHTML = 'Are we there yet?';
// append theKid to the end of theParent
theParent.appendChild(theKid);
// prepend theKid to the beginning of theParent
theParent.insertBefore(theKid, theParent.firstChild);
@foru17
foru17 / getHttpRequest.js
Created June 10, 2014 07:21
JavaScript 发送 GET请求
function httpGet(theUrl)
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
@foru17
foru17 / markdownvideo.html
Created June 7, 2014 06:17
在Markdown中添加视频方法
<video id="video" controls="" preload="none" poster="http://media.w3.org/2010/05/sintel/poster.png">
<source id="mp4" src="http://media.w3.org/2010/05/sintel/trailer.mp4" type="video/mp4">
<source id="webm" src="http://media.w3.org/2010/05/sintel/trailer.webm" type="video/webm">
<source id="ogv" src="http://media.w3.org/2010/05/sintel/trailer.ogv" type="video/ogg">
<p>Your user agent does not support the HTML5 Video element.</p>
</video>