Skip to content

Instantly share code, notes, and snippets.

View GZShi's full-sized avatar
🎯
Focusing

Guozhong Shi GZShi

🎯
Focusing
View GitHub Profile
var fastItoa = (function () {
// 使用 2n 作为索引
var table = [
'0', '0',
'0', '1',
'0', '2',
...
'9', '8',
'9', '9'
];
@GZShi
GZShi / designer.html
Last active August 29, 2015 14:19
designer
<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>
@GZShi
GZShi / bug.html
Created March 31, 2015 13:06
iOS 8.2 safari fixed position bug
<!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 {
http://www.zhihu.com/question/20160414
@GZShi
GZShi / clone.js
Created November 21, 2014 03:33
Object clone
function clone(obj) {
return JSON.parse(JSON.stringify(obj));
}
@GZShi
GZShi / 11.11.js
Last active August 29, 2015 14:09
定时秒杀
/**
* 1. 更改日期和时间设置
* 2. Internet 时钟
* 3. 更改设置
* 4. time.pool.aliyun.com
* 5. 立即更新
* 6. 确定
*/
/**
@GZShi
GZShi / type.js
Created October 28, 2014 09:06
简单的类型检测
/**
* 类型检测
*
* @param obj {} 待检测的对象
* @return {object}
*/
function type(obj) {
return {
'type': Object.prototype.toString.call(obj).substr(8).split(']')[0],
'toString': function () { return this.type; },
@GZShi
GZShi / index.html
Last active August 29, 2015 14:06
Sort Animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sort Animation</title>
<script src="sort_animation.js"></script>
</head>
<body>
<style>
body {
@GZShi
GZShi / code_snippet.js
Last active August 29, 2015 14:06
snippets
// [" 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;
});
}
@GZShi
GZShi / flatten_array.js
Last active August 29, 2015 14:06
flatten array
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;
}