Skip to content

Instantly share code, notes, and snippets.

View ouyangzhiping's full-sized avatar

Zhiping Yang ouyangzhiping

View GitHub Profile
@Gregg
Gregg / gist:968534
Created May 12, 2011 13:54
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@rik0
rik0 / adjacency_list.py
Created June 6, 2011 10:21
Snippets on graph & network theory
class AdjacencyListGraph(object):
def __init__(self):
self.node = {}
self.adj = {}
def add_node(self, node, **attrs):
if node not in self.adj:
self.adj[node] = {}
self.node[node] = attrs
@xdite
xdite / gist:1031760
Created June 17, 2011 16:35
Best Practice of Installing Ruby on Rails on Ubuntu 11.04 ( 2011 version )
  • 警告:請絕對不要跳著裝!*

系統套件

進行 Ubuntu 系統更新 / 安裝 MySQL

 > sudo apt-get update
 > sudo apt-get upgrade
 > sudo apt-get install git
@ouyangzhiping
ouyangzhiping / class_base_003.js.coffee
Created June 20, 2011 01:05 — forked from cnruby/class_base_003.js.coffee
HOW TO USE PROTOTYPE for CofffeeScript
# 理解JavaScript的prototype属性
#
# 类Dog - 类名称
# 属性name - 类Dog的对象属性
# 类属性species - 类Dog的类属性
# 对象dog_a - 类Dog的对象
# 对象dog_b - 类Dog的对象
#
# 类属性species是prototype对象的属性;
# 类Dog.prototype是实例对象共享的对象;
@cnruby
cnruby / class_base_004.js
Created June 20, 2011 05:30
HOW TO USE METHODS for CofffeeScript
// 理解类的方法
//
// 第一段代码是使用默认类,定义和使用函数
// 第二段代码是使用类<类Person>,定义和使用函数
//
// 函数吃 - 函数名称
// 属性修饰 - 属性名称
// 属性食品 - 属性名称
// 类人 - 类名称
// 对象道喜 - 类的对象名称
<html>
<head>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="http://localhost/arbor/lib/arbor.js" ></script>
<script language="javascript" type="text/javascript" src="http://localhost/arbor/demos/_/graphics.js" ></script>
<script language="javascript" type="text/javascript" src="http://localhost/arbor/demos/halfviz/src/renderer.js" ></script>
</head>
<body>
<canvas id="viewport" width="800" height="600"></canvas>
<script language="javascript" type="text/javascript">
00:58 /p/tmp> jruby bm.rb
Rehearsal ------------------------------------------------
inject(fold) 2.898000 0.000000 2.898000 ( 2.821000)
Hash+map 2.412000 0.000000 2.412000 ( 2.412000)
--------------------------------------- total: 5.310000sec
user system total real
inject(fold) 2.477000 0.000000 2.477000 ( 2.477000)
Hash+map 2.292000 0.000000 2.292000 ( 2.292000)
@ouyangzhiping
ouyangzhiping / .bash_login
Created July 11, 2011 15:58
My .bash_login file with git+brew support+textmate
# PATH ------------------------------------------------------------
export PATH="/usr/local/bin:/usr/local/Cellar/ruby/1.9.2-p180/bin/:/usr/local/sbin:~/bin/:$PATH"
# Add Bash Completion ---------------------------------------------
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# Add Bash Completion support for Brew ----------------------------
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
@ouyangzhiping
ouyangzhiping / nginx.sh
Created September 6, 2011 08:47 — forked from marshluca/nginx.sh
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@pithyless
pithyless / gist:1208841
Created September 10, 2011 21:49
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...