Skip to content

Instantly share code, notes, and snippets.

View lgh06's full-sized avatar

Daniel Liu lgh06

View GitHub Profile
@lgh06
lgh06 / meta.html
Created April 17, 2014 04:34 — forked from Jimco/meta.html
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 -->
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome -->
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <!-- 360 浏览器内核控制 -->
<!--
content的取值为webkit,ie-comp,ie-stand之一,区分大小写,分别代表用webkit内核,IE兼容内核,IE标准内核。
//压缩js 配置
fis.config.set('settings.optimizer.uglify-js', {
mangle: {
except: 'exports, module, require, define,bed,wx,jQuery,$'
}
});
//自动去除console.log等调试信息
fis.config.set('settings.optimizer.uglify-js', {
compress: {
if (typeof module === "object" && module && typeof module.exports === "object") {
module.exports = exports;
} else if (typeof define === "function" && define.amd) {
define(['base64','template','bedtime'],function (Base64,template,bed) {
return exports;
});
} else {
window.bed.sharingInit = sharingInit;
}
/*
* Replace all SVG images with inline SVG
*/
function replaceSvg(){
jQuery('.up img').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
@lgh06
lgh06 / less-loop-1
Last active October 9, 2015 08:26
less-loop-1
.generate-columns(9);
.generate-columns(@n, @i: 1) when (@i =< @n) {
.float@{i} {
animation: ~'float@{i}' 5s ease-in-out infinite;
}
.generate-columns(@n, (@i + 1));
}
result :
#rotate(@deg){
transform: rotate(@deg);
}
@myWiggle: {
10% { #rotate(14deg); }
100% { #rotate(0deg); }
};
@lgh06
lgh06 / wx_getuserinfo.php
Last active October 21, 2015 03:23
微信手机端 网页 登陆(CI框架中的一个Model)
<?php
/**
* 手机网页端三方登陆Model
* by 刘各欢 20150730
* http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
***/
$id = config_item('wx_appid');
$sec = config_item('wx_appsecret');
define("APPID", $id);
define("APPSECRET",$sec);
@lgh06
lgh06 / simpRouter.js
Created October 29, 2015 03:51
一个简单的router js
var wawa = {};
wawa.Router = function(){
function Router(){
}
Router.prototype.setup = function(routemap, defaultFunc){
var that = this, rule, func;
this.routemap = [];
this.defaultFunc = defaultFunc;
for (var rule in routemap) {

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () =&gt; x) {
@lgh06
lgh06 / testTouch.js
Created December 14, 2015 06:20
jquery touch event,clientY,pageY
$(document).on('touchstart touchend','html',function($e){
var e = $e.originalEvent;
var list = e.touches;
var changedList = e.changedTouches;
console.log(e);
console.log(changedList[0].pageX);
console.log(changedList[0].pageY);
console.log(changedList[0].clientX);
console.log(changedList[0].clientY);