Skip to content

Instantly share code, notes, and snippets.

View wangzuo's full-sized avatar
🎯
Focusing

Wang Zuo wangzuo

🎯
Focusing
View GitHub Profile
@wangzuo
wangzuo / settings
Last active December 18, 2015 14:19
sublime text 2 configuration
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"font_size": 12.0,
"font_face": "monaco",
"word_wrap": true,
"wrap_width": 80,
"line_padding_bottom": 1,
"line_padding_top": 1,
"highlight_modified_tabs": true,
"highlight_line": true,
@wangzuo
wangzuo / .vimrc
Last active December 18, 2015 19:49
vimrc
execute pathogen#infect()
filetype plugin indent on
set encoding=utf-8
set tabstop=2
set expandtab
set shiftwidth=2
set shiftround
set ai
set si
/**
* Stylesheet that implements Entypo font
* http://www.entypo.com/
*
* Autor Yordan Ivanov
* [email protected]
*/
@font-face {
font-family: 'EntypoRegular';
[
{ "keys": ["f8"], "command": "reindent"},
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }
]
@wangzuo
wangzuo / debource.js
Created December 22, 2013 05:40
javascript debounce function
(function($, sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
/*
highlight v3 !! Modified by Jon Raasch (http://jonraasch.com) to fix IE6 bug !!
Highlights arbitrary terms.
<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
MIT license.
@wangzuo
wangzuo / pubsub.md
Created February 27, 2014 11:14 — forked from addyosmani/pubsub.md

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.0.deb
sudo dpkg -i elasticsearch-1.1.0.deb
@wangzuo
wangzuo / nginx.conf
Last active August 29, 2015 14:02 — forked from Stanback/nginx.conf
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [