Skip to content

Instantly share code, notes, and snippets.

View gonghao's full-sized avatar
😂
Nothing

Howtin gonghao

😂
Nothing
View GitHub Profile
function getNextSibling(ele) {
while (ele = ele.nextSibling) {
if (1 === ele.nodeType) return ele;
}
}
@gonghao
gonghao / chinese_matching.py
Created October 27, 2011 07:54
Python 2.x 中文字符匹配
import re
re.search(u'[\u4e00-\u9fa5]+', text.decode('utf-8'))
@gonghao
gonghao / 12306.user.js
Created January 8, 2012 01:05 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
@gonghao
gonghao / dabblet.css
Created November 22, 2012 06:54
Untitled
.wrap { background: #ccc; }
.logo { display: inline-block; background: green; }
.links { float: right; }
@gonghao
gonghao / dabblet.css
Created November 22, 2012 06:54
Untitled
.wrap { background: #ccc; }
.logo { display: inline-block; background: green; }
.links { float: right; }
@gonghao
gonghao / dabblet.js
Created December 3, 2012 03:34
Untitled
var a = document.createElement('a');
a.href = '/test/hello/world';
alert(a.pathname)
@gonghao
gonghao / shaker.css
Created December 21, 2012 08:19
shaker animation like iOS icon sorting shaker animation
@-webkit-keyframes shaker {
0% { -webkit-transform: translate(1px, 0px) rotate(0deg); }
10% { -webkit-transform: translate(0px, -1px) rotate(-1deg); }
20% { -webkit-transform: translate(-2px, 0px) rotate(1deg); }
30% { -webkit-transform: translate(0px, 1px) rotate(0deg); }
40% { -webkit-transform: translate(0px, -0px) rotate(1deg); }
50% { -webkit-transform: translate(0px, 1px) rotate(-1deg); }
60% { -webkit-transform: translate(-2px, 0px) rotate(0deg); }
70% { -webkit-transform: translate(1px, 0px) rotate(-1deg); }
80% { -webkit-transform: translate(0px, 0px) rotate(1deg); }
@gonghao
gonghao / dabblet.css
Created December 28, 2012 03:52 — forked from kejun/dabblet.css
Untitled
.rating {
unicode-bidi: bidi-override;
direction: rtl;
text-align: center;
}
.rating label {
display: inline-block;
width: 24px;
@gonghao
gonghao / example.js
Created December 28, 2012 14:55
Empty an Array with JavaScript
myArray = []; // bad
myArray.length = 0; // good!
@gonghao
gonghao / gist:5035615
Created February 26, 2013 03:24
How to Clean Up Your Mac’s “Open With” Contextual Menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user