@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:
(function(x, f = () => x) {
<!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'); | |
.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); } | |
}; | |
<?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); |
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 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:
(function(x, f = () => x) {
$(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); |