Skip to content

Instantly share code, notes, and snippets.

View kerryChen95's full-sized avatar

Kerry kerryChen95

  • AutoX
  • Beijing, China
  • 02:23 (UTC +08:00)
View GitHub Profile
@kerryChen95
kerryChen95 / dabblet.css
Last active June 18, 2018 08:54
scroll inside on rotate 90deg
/**
* The first commented line is your dabblet’s title
*/
html, body {
background: #f06;
height: 100%;
}
#ctn {
.hd, .ft {
height: 20px;
background-color: red;
}
.bd::after {
content: '';
clear: both;
height: 0;
line-height: 0;
visibility: hidden;
.hd, .ft {
height: 20px;
background-color: red;
}
.bd::after {
content: '';
clear: both;
height: 0;
line-height: 0;
visibility: hidden;
@kerryChen95
kerryChen95 / dabblet.css
Created December 20, 2014 04:51
Untitled
.hd, .ft {
height: 20px;
background-color: red;
}
.bd {
overflow: hidden;
}
.bd::after {
content: '';
clear: both;
@kerryChen95
kerryChen95 / dabblet.css
Last active August 29, 2015 14:11
Untitled
.hd, .ft {
height: 20px;
background-color: red;
}
.bd {
overflow: hidden;
}
.bd::after {
content: '';
clear: both;
@kerryChen95
kerryChen95 / foo.css
Created November 3, 2014 12:16
`attr()` function for CSS `content` property
.foo:before {
content: attr(data-line-number); // equal `content: 95`
}

怎样更快的让页面可见且可操作

讨论的前提条件:

  1. head里的css文件体积较大,加载时间较长
  2. 要求不仅能够尽快展现东西给用户(需要尽快加载、解析完相应的html+css),还要让用户能够尽快交互某些东西(在此以搜索框为例,需要尽快加载、解析完相应的html+js)
  3. 对不支持预加载的浏览器

分析

@kerryChen95
kerryChen95 / gist:8591272
Created January 24, 2014 02:50
`JSON.parse()` cannot parse string...Notice when parse network response in JSON
JSON.parse('')
// SyntaxError: Unexpected end of input
JSON.parse('vds')
// SyntaxError: Unexpected token v
@kerryChen95
kerryChen95 / uniqueId.js
Created December 6, 2013 15:43
create unique id and check duplication.
function check() {
var hash = {},
key,
times = Math.pow(10, 9),
i = 1;
do {
key = create3();
if (hash[key]) {
git checkout topic-branch
git rebase master
git checkout master
git merge topic-branch