Skip to content

Instantly share code, notes, and snippets.

View fanweixiao's full-sized avatar
🦖
hacking on @yomorun

C.C. fanweixiao

🦖
hacking on @yomorun
View GitHub Profile
@fanweixiao
fanweixiao / gist:2693126
Created May 14, 2012 10:23
Parentheses usage in coffeescript
alert ((_)->((_)->_+_)(((_)->_*_)(_))) 10
@fanweixiao
fanweixiao / gist:2693277
Created May 14, 2012 10:53
coffeescript variable just var once
a = (_)->
a=_
(__,_)->
(__+_)*a
alert (a 10) a,3
@fanweixiao
fanweixiao / gist:3306907
Created August 9, 2012 18:36
flick hosts
106.10.137.23 farm9.staticflickr.com
106.10.137.23 farm8.staticflickr.com
106.10.137.23 farm7.staticflickr.com
106.10.137.23 farm6.staticflickr.com
106.10.137.23 farm5.staticflickr.com
106.10.137.23 farm4.staticflickr.com
@fanweixiao
fanweixiao / gist:3376529
Created August 17, 2012 06:40 — forked from dervn/gist:3375687
龍應台:我們的「中國夢」(8月1日北京大學演講講辭)

龍應台:我們的「中國夢」(8月1日北京大學演講講辭)

【明報專訊】第一次接到電話,希望我談談「中國夢」的時候,我的第一個反應是:「一千枚飛彈對準我家,我哪裏還有中國夢啊?」

可是沉靜下來思索,1952年生在台灣的我,還有我前後幾代人,還真的是在「中國夢」裏長大的,我的第一個中國夢是什麼呢?

我們上幼稚園時,就已經穿著軍人的制服、帶著木製的步槍去殺「共匪」了,口裏唱著歌。當年所有的孩子都會唱的那首歌,叫做《反攻大陸去》:

反攻 反攻 反攻大陸去
@fanweixiao
fanweixiao / gist:3414543
Created August 21, 2012 11:01 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@fanweixiao
fanweixiao / gist:3786595
Created September 26, 2012 07:29
gem install pg on CentOS 6.3
gem install pg -- --with-pg-lib=/usr/pgsql-9.1/lib --with-pg-config=/usr/pgsql-9.1/bin/pg_config
==========
$ export PATH=/usr/pgsql-9.1/bin:$PATH
$ uname -a
$ export ARCHFLAGS=' -arch x86_64'
$ bundle install
==========
@fanweixiao
fanweixiao / gist:3878635
Created October 12, 2012 10:40
[top] tips
【z】 to toggle color.
【x】 to toggle coloring of sort column.
【s 9 9 Enter ↵】 to set update frequency to every 99 seconds.
【Space】 to force a update.
【>】 to change the sort column to the right of current sort column.
【<】 to change the sort column to the left.
【R】to toggel reverse sort order.
【O k Enter ↵】 to order by CPU usage. (also 【P】)
【O n Enter ↵】 to order by memory usage. (also 【M】)
@fanweixiao
fanweixiao / Macros.h
Created November 19, 2012 07:51 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
@fanweixiao
fanweixiao / gist:4134260
Created November 23, 2012 06:39
uber writer
sudo add-apt-repository ppa:w-vollprecht/ppa
sudo apt-get update
sudo apt-get install uberwriter
UberWriter 非常简单易用,主要功能如下:
具备预览功能( Ctrl+P) ,全屏功能及专注书写模式
提供 斜体 、粗体、项目列表等快捷键。
支持导出到 PDF (需安装 texlive)、Html 、OTD 、LaTex 、ePub 等多种文档格式。
var fs = require('fs'),
util = require('util'),
Stream = require('stream').Stream;
/**
* Create a bandwidth limited stream
*
* This is a read+writeable stream that can limit how fast it
* is written onto by emitting pause and resume events to
* maintain a specified bandwidth limit, that limit can