Skip to content

Instantly share code, notes, and snippets.

Bohao Chen altair21

Block or report user

Report or block altair21

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@altair21
altair21 / addLoadEvent.js
Last active Aug 18, 2016
《DOM Scripting》 suggest function
View addLoadEvent.js
//add function to run after windown.onload
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
View 18x-spider.py
#coding=utf-8
import urllib2
import re
import os
savePath = os.path.join(os.getcwd(), 'xImages')
def start(url):
page = urllib2.urlopen(url)
html = page.read()
reg = r'<a class="movie-box" href=".*">'
View docker push steps
step1——找到本地镜像的ID:docker images
step2——登陆Hub:docker login --username=username --password=password --email=email
step3——tag:docker tag <imageID> <namespace>/<image name>:<version tag eg latest>
step4——push镜像:docker push <namespace>/<image name>
View Share sessionStorage.js
// Removed IE support in this demo for the sake of simplicity
(function() {
if (!sessionStorage.length) {
// Ask other tabs for session storage
localStorage.setItem('getSessionStorage', Date.now());
};
// Core
window.addEventListener('storage', function(event) {
if (event.key == 'getSessionStorage') {
// Some tab asked for the sessionStorage -> send it
@altair21
altair21 / Typeahead-BS3-css.css
Created Nov 7, 2016 — forked from mixisLv/Typeahead-BS3-css.css
Bootstrap 3 style fixes for using Typeahead.js
View Typeahead-BS3-css.css
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
View embed.js
//HelloDog - http://wsgzao.github.io/post/duoshuo/
//More info: http://moxfive.xyz/2015/09/29/duosuo-style
//移动客户端判断开始
function checkMobile() {
var isiPad = navigator.userAgent.match(/iPad/i) != null;
if (isiPad) {
return false;
}
var isMobile = navigator.userAgent.match(/iphone|android|phone|mobile|wap|netfront|java|opera mobi|opera mini|ucweb|windows ce|symbian|symbianos|series|webos|sony|blackberry|dopod|nokia|samsung|palmsource|xda|pieplus|meizu|midp|cldc|motorola|foma|docomo|up.browser|up.link|blazer|helio|hosin|huawei|novarra|coolpad|webos|techfaith|palmsource|alcatel|amoi|ktouch|nexian|ericsson|philips|sagem|wellcom|bunjalloo|maui|smartphone|iemobile|spice|bird|zte-|longcos|pantech|gionee|portalmmm|jig browser|hiptop|benq|haier|^lct|320x320|240x320|176x220/i) != null;
if (isMobile) {
View tmux-cheatsheet.markdown

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
You can’t perform that action at this time.