Skip to content

Instantly share code, notes, and snippets.

/**
* Simple storage warpper.
* @module storage
* @author Allex Wang (http://iallex.com)
*/
(function (define) {
define('storage', function (require) {
var storage = null;
var localStorage = window.localStorage;
#!/bin/bash
# ================================================
# Description: killport.sh
# GistID: 8b399a93749703acd780
# GistURL: https://gist.github.com/allex/8b399a93749703acd780
# Last Modified: Sun Aug 10, 2014 12:22PM
# Author: Allex Wang ([email protected])
# ================================================
@allex
allex / test.sh
Last active August 29, 2015 14:03
#!/bin/sh
# ================================================
# Description: %TITLE%
# GistID: 7e3585ff55b75f5cfe7a
# Last Modified: Sun Jul 13, 2014 12:12PM
# Author: Allex Wang ([email protected])
# ================================================
BASEDIR=`dirname $0`
#!/bin/bash
# ================================================
# Description: Deploy current project happy
# GistID: cb0c8000aca295926ffa
# GistURL: https://gist.github.com/allex/cb0c8000aca295926ffa
# Last Modified: Tue Aug 05, 2014 11:39AM
# Author: Allex Wang ([email protected])
# ================================================
#!/usr/bin/env ruby
require 'io/console'
# GistID: 79d772509ab366776d1d
if __FILE__ == $0
branch_name = ARGV[0] if (ARGV[0])
print "Press Y to force delete local and remote branch #{branch_name}..."
response = STDIN.getch
if ['Y', 'y', 'yes'].include?(response)
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
// Author: Allex Wang
// GistID: ebdb822006afb8b1c2df
// GistURL: https://gist.github.com/ebdb822006afb8b1c2df
// Simple sprintf implement
var sprintf = function(format) {
var return_str = new String(format);
var match;
var reg = /%([osif])/i;
var before, after, replacement;
#!/bin/sh
#
# lighttpd Startup script for the lighttpd server
#
# chkconfig: - 85 15
# description: Lightning fast webserver with light system requirements
#
# processname: lighttpd
# config: /etc/lighttpd/lighttpd.conf
# config: /etc/sysconfig/lighttpd
// GistID:
// GistURL:
function getID(idLength) {
var chars = '0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_'.split(',');
var min = 0, max = chars.length - 1, unique_id = '';
for (var i = 0; i < idLength; i++) {
unique_id += chars[Math.floor(Math.random() * (max - min + 1) + min)];
}
return unique_id;