This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fastItoa = (function () { | |
// 使用 2n 作为索引 | |
var table = [ | |
'0', '0', | |
'0', '1', | |
'0', '2', | |
... | |
'9', '8', | |
'9', '9' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<polymer-element name="my-element"> | |
<template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="blue"> | |
<title>bug</title> | |
<style> | |
.nav { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.zhihu.com/question/20160414 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clone(obj) { | |
return JSON.parse(JSON.stringify(obj)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 1. 更改日期和时间设置 | |
* 2. Internet 时钟 | |
* 3. 更改设置 | |
* 4. time.pool.aliyun.com | |
* 5. 立即更新 | |
* 6. 确定 | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 类型检测 | |
* | |
* @param obj {} 待检测的对象 | |
* @return {object} | |
*/ | |
function type(obj) { | |
return { | |
'type': Object.prototype.toString.call(obj).substr(8).split(']')[0], | |
'toString': function () { return this.type; }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Sort Animation</title> | |
<script src="sort_animation.js"></script> | |
</head> | |
<body> | |
<style> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [" 1 ", "2", "", " ", "3", "4 ", "5 "] => ["1", "2", "3", "4", "5"] | |
function foo(arr) { | |
return arr.map(function (e) { | |
return e.trim(); | |
}).filter(function (e) { | |
return e.length > 0; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flattenWithReduce = (function () { | |
function flatten(prev, curr, i, a) { | |
var result; | |
if(Array.isArray(curr)) { | |
result = prev.concat(curr.reduce(flatten, [])); | |
} else { | |
result = prev.concat(curr); | |
} | |
return result; | |
} |