Skip to content

Instantly share code, notes, and snippets.

View QETHAN's full-sized avatar
🎯
Focusing

QETHAN QETHAN

🎯
Focusing
View GitHub Profile
@QETHAN
QETHAN / php捕获异常信息
Created August 31, 2014 08:03
php捕获异常信息
<?php
try {
throw new Exception('wrong');
} catch(Exception $ex) {
$msg = 'Error:'.$ex->getMessage()."\n";
$msg.= $ex->getTraceAsString()."\n";
$msg.= '异常行号:'.$ex->getLine()."\n";
$msg.= '所在文件:'.$ex->getFile()."\n";
//将异常信息记录到日志中
file_put_contents('error.log', $msg);
@QETHAN
QETHAN / php验证码
Created August 31, 2014 07:51
php 随机验证码
<?php
$img = imagecreatetruecolor(100, 40);
$black = imagecolorallocate($img, 0x00, 0x00, 0x00);
$green = imagecolorallocate($img, 0x00, 0xFF, 0x00);
$white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
imagefill($img,0,0,$white);
//生成随机的验证码
$code = '';
for($i = 0; $i < 4; $i++) {
$code .= rand(0, 9);
.has-transition {
-webkit-transition: margin-left 1s ease-out;
-moz-transition: margin-left 1s ease-out;
-o-transition: margin-left 1s ease-out;
transition: margin-left 1s ease-out;
}
li {
background: #ccc;
border: 1px #000 solid;
img{
max-width: 100%;
vertical-align: top;
height: auto;
width: auto;
}
.type{
max-width: 50em;
margin: auto;
@QETHAN
QETHAN / gist:1c6fb40686b2f8664293
Created July 9, 2014 04:03
常用字体设置
'Helvetica Neue', Arial, 'Hiragino Sans GB',
'Microsoft Yahei', 'WenQuanYi Micro Hei', sans-serif;
@QETHAN
QETHAN / background-image
Created July 7, 2014 03:38
background-image 模糊
background-image: -webkit-linear-gradient(-410deg, rgba(68, 68, 68, 0.6) 20%, rgba(0, 0, 0, 0.9));
@QETHAN
QETHAN / ad
Created July 7, 2014 02:20
视频广告屏蔽插件
if(!document.URL.match(new RegExp('v\\.baidu\\.com'))){
(function() {
Function.prototype.bind = function() {
var fn = this, args = Array.prototype.slice.call(arguments), obj = args.shift();
return function() {
return fn.apply(obj, args.concat(Array.prototype.slice.call(arguments)));
};
};
function A() {}
A.prototype = {
@QETHAN
QETHAN / jquery_browser_IE7
Created June 27, 2014 13:39
jquery检测 IE浏览器版本
if ($.browser.msie && parseInt($.browser.version, 10) === 7) {
alert('IE7');
} else {
alert('Non IE7');
}
@QETHAN
QETHAN / verticle-center
Created June 24, 2014 10:52
垂直居中,容器高度固定,内容高度不定
* {
margin: 0;
padding: 0;
}
.cont {
background-color: #ccc;
font-size: 24px;
height: 150px;
text-align: center;
overflow: hidden;
@QETHAN
QETHAN / html_load_animation
Created June 24, 2014 08:57
页面载入动画效果
html { -webkit-animation-name:thePage; -webkit-animation-duration:600ms; -webkit-animation-timing-function:ease-in-out; } @-webkit-keyframes thePage { 0% { opacity: 0; -webkit-transform: translateY(-50px); } 100% { opacity: 1; -webkit-transform: translateY(0); }}
@-webkit-keyframes thePage { 0% { opacity: 0; -webkit-transform: translateY(-50px); } 100% { opacity: 1; -webkit-transform: translateY(0)