Skip to content

Instantly share code, notes, and snippets.

View Go7hic's full-sized avatar
👓
👖

Go7hic Go7hic

👓
👖
View GitHub Profile
@Go7hic
Go7hic / javascriptdatastructure.md
Created February 9, 2017 15:30
javascript 数据结构算法 #tags: javascript datastructure

数据结构

数据结构(英语:data structure)是计算机中存储、组织数据的方式。——维基百科

  • 数组(Array)
  • 栈(Stack)
  • 队列(Queue)
  • 链表(Linked List)
  • 集合(Set)
  • 散列表(Hash) 和 字典(Map)
  • 树(Tree)
@Go7hic
Go7hic / jspattern.js
Last active February 7, 2017 03:41
JS 设计模式 #tags: 设计模式
// 策略模式
var validator = {
types: {},
messages: [],
config: {},
validate: function (data) {
@Go7hic
Go7hic / checkie.js
Last active February 7, 2017 03:29
判断ie浏览器 #tags: IE
//ie9-
var isIE9_ = document.all && !window.atob;
// ie8-
var isIE8_ = document.all && !document.addEventListener;
var isIE8_ = '\v'=='v';
var isIE8_ = !+'\v1';
// ie7-
@Go7hic
Go7hic / HTML-tags.md
Last active February 7, 2017 01:57 — forked from yisibl/HTML-tags.md
常用的 HTML 头部标签 #tags: html

常用的 HTML 头部标签

详细介绍参见原文:yisibl/blog#1

<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
    <meta charset='utf-8'> <!-- 声明文档使用的字符编码 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用 IE 最新版本和 Chrome -->
@Go7hic
Go7hic / CSStx.html
Last active February 7, 2017 01:56
CSS 画的头像 #tags: cssdemo
<h1>cssfaces.com</h1>
<!--class .demo just for this demo-->
<div class="demo">
<span class="hair"></span>
<header>
<span class="eyes"></span>
<span class="nose"></span>
<span class="accessoire"></span>
</header>
</div>
@Go7hic
Go7hic / stringrender.js
Last active February 6, 2017 14:03
ES6 字符串模板渲染函数 #tags: ES6
function render (template, options) {
return template.replace(/\{\{\s?(\w+)\s?\}\}/g, (match, variable) => {
return options[variable] || ''
})
}
@Go7hic
Go7hic / input.html
Created September 7, 2016 12:46
input type number
<!DOCTYPE html>
<html lang="en">
<head>
<title>input</title>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"
/>
<style>
@Go7hic
Go7hic / js自动轮播效果
Last active June 14, 2016 11:18
7-1 js自动轮播效果
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js图片轮播</title>
<style>
body,div,ul,li{margin:0;padding:0;}
ul{list-style-type:none;}
body{background:#000;text-align:center;font:12px/20px Arial;}
#box{position:relative;width:492px;height:172px;background:#fff;border-radius:5px;border:8px solid #fff;margin:10px auto;cursor:pointer;}
@Go7hic
Go7hic / what-forces-layout.md
Created June 13, 2016 01:39 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
var obj = {
value = 1,
increment: function() {
this.value += 1;
return this;
},
add: function (v) {
this.value += v;
return this
},