Skip to content

Instantly share code, notes, and snippets.

View gonghao's full-sized avatar
😂
Nothing

Howtin gonghao

😂
Nothing
View GitHub Profile
@gonghao
gonghao / newmac.md
Last active December 14, 2015 18:58

重装 Mac OS X 的必备工作

var THRESHOLD = 150, DELAY = 15;
function initBigArrayAsync(max, cb) {
var r = [], i = 0;
function init(startTime) {
while (i < max) {
if (new Date - startTime < THRESHOLD) {
r[i++] = i;
} else {
(function() {
if (typeof define !== 'undefined') {
return;
}
var win = window;
var modules = {
host: win
};
@gonghao
gonghao / tmp.js
Created May 16, 2013 04:32
toggle make scroll rock!
commodityImages.click(function(evt) {
var cont = $(this),
zoomIn = !cont.hasClass('zoom');
// should not use toggle function to prevent scroll rock
if (zoomIn) {
items.hide();
largeItems.show();
} else {
items.show();
function format(tpl, obj) {
var key, reg;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
reg = new RegExp('\\{' + key.toUpperCase() + '\\}', 'g');
tpl = tpl.replace(reg, obj[key]);
}
}
return tpl;
}
var Event = (function() {
'use strict';
var gEvents = {},
uidCount = 0,
ukey = '-douban-simple-event-uid',
getEventsRepo = function(obj) {
var uid, events;
@gonghao
gonghao / dabblet.css
Created June 19, 2013 06:54
Untitled
.box {
width: 240px;
overflow: hidden;
}
.quote-wrap {
display: inline-block;
text-align: left;
vertical-align: top;
background: url("http://www.douban.com/pics/ilmen/commodity/quotel.png") no-repeat scroll left top transparent;
@gonghao
gonghao / dabblet.css
Created June 19, 2013 06:54
Untitled
.box {
width: 240px;
}
.quote-wrap {
background: url("http://www.douban.com/pics/ilmen/commodity/quotel.png") no-repeat scroll left top transparent;
font-size: 14px;
line-height: 1.5;
padding-left: 22px;
text-align: justify;
@gonghao
gonghao / dabblet.css
Created June 20, 2013 02:12
Untitled
ul { font-size:0; border-bottom: 1px solid #ccc; }
ul > li { display: inline-block; font-size: 12px; border-bottom: 1px solid red; margin-bottom: -1px; }
@gonghao
gonghao / dabblet.css
Created June 20, 2013 09:13
Untitled
.box { width: 240px; height: 200px; background: #ccc; }
.box:hover h5 { text-decoration: underline; }