Skip to content

Instantly share code, notes, and snippets.

View jiahut's full-sized avatar
🎯
Focusing

zhijia,.zhang jiahut

🎯
Focusing
View GitHub Profile
@jiahut
jiahut / gist:3938680
Created October 23, 2012 13:18 — forked from buhrmi/gist:1344659
Sublime Text 2 Git Annotation Colors
<dict>
<key>name</key>
<string>Git Modified Line</string>
<key>scope</key>
<string>git.changes.x</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#272852</string>
</dict>
@jiahut
jiahut / Native_FullScreen.js
Created November 9, 2012 08:53 — forked from sofish/Native_FullScreen.js
Native FullScreen JavaScript API
/*
Native FullScreen JavaScript API
CopyRight: Johndyer, http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/
-------------
Assumes Mozilla naming conventions instead of W3C for now
*/
(function() {
var
fullScreenApi = {
supportsFullScreen: false,
@jiahut
jiahut / quick_to_dev_backbone.js
Last active October 17, 2016 01:20
require jquery and backbone in cosole and coding...
(function(undefined){
var _requirejs = document.createElement('script');
_requirejs.src = "http://requirejs.org/docs/release/2.1.5/minified/require.js";
_requirejs.type ="text/javascript";
document.head.appendChild(_requirejs);
setTimeout(function(){
require('http://code.jquery.com/jquery-1.9.1.min.js'.split(";"));
require('http://underscorejs.org/underscore-min.js'.split(";"),function(){
require('http://backbonejs.org/backbone-min.js'.split(";"))
});
@jiahut
jiahut / deferred_notify_progressCallbacks.js
Last active December 15, 2015 21:49
Deferred notify and progress Callbacks
var dfd = $.Deferred();
dfd.progress(function(arg){ console.log(arg,1)});
dfd.notify('this is first time notify:I am jazz')
dfd.progress(function(arg){ console.log(arg,2)});
dfd.notify('this is second time notify: I love this game');
dfd.reject('sorry,badthing arise');
dfd.progress(function(arg){ console.log(arg,3)});
dfd.notify("this is third time notify: I will come back ?")
dfd.progress(function(arg){ console.log(arg,4)});
@jiahut
jiahut / emacs.d
Last active December 25, 2015 04:49
emacs.d
;;(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
(let ((default-directory "~/.emacs.d/"))
(normal-top-level-add-subdirs-to-load-path))
;("ELPA" . "http://tromey.com/elpa/")
;("gnu" . "http://elpa.gnu.org/packages/")
;("SC" . "http://joseito.republika.pl/sunrise-commander/")
(require 'package)
@jiahut
jiahut / gist:d29dd29b62fe30b2e699
Last active August 29, 2015 14:07
stylus usage demo
$title-color
color red
.a
@extends $title-color
.title-color2
color red
.b
@extends .title-color2
yum install build-essential autoconf libtool openssl-devel gcc git -y
cd /tmp/
git clone --depth=1 https://github.com/madeye/shadowsocks-libev.git
cd shadowsocks-libev
./configure --disable-documentation
make && make install
mkdir -p ~/bin
#生成 RSA 私钥(传统格式的)
openssl genrsa -out rsa_private_key.pem 1024
#将传统格式的私钥转换成 PKCS#8 格式的
openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt
#生成 RSA 公钥
#!/bin/sh
#
# /etc/rc.d/init.d/docker
#
# Daemon for docker.com
#
# chkconfig: 2345 95 05
# description: Daemon for docker.com
### BEGIN INIT INFO
function compile(template){
var evalExpr = /<%=(.+?)%>/g;
var expr = /<%([\s\S]+?)%>/g;
template = template
.replace(evalExpr, '`);\n echo( $1 );\n echo(`')
.replace(expr, '`);\n $1 \n echo(`');
template = 'echo(` ' + template + '`);';
var script = `