Skip to content

Instantly share code, notes, and snippets.

View fundon's full-sized avatar
🎯
Focusing

Fangdun Tsai fundon

🎯
Focusing
View GitHub Profile
Rails (or Node.js) Web App for syncing data folders between Google Docs and Dropbox. No desktop client needed.
- OAuth (a must!)
- Dropbox API:
+ https://www.dropbox.com/developers/releases (OAuth)
+ http://github.com/riscfuture/dropbox (OAuth)
- Google Docs GData API:
+ http://code.google.com/apis/gdata/articles/gdata_on_rails.html (OAuth)
+ http://cookingandcoding.com/2010/04/28/gdocs4ruby-access-google-docs-api-with-ruby/
- "Google Docs" folder, be able to rename it
@fundon
fundon / gist:755990
Created December 27, 2010 09:30
JQUERY PLUGIN: ‘AUTORESIZE’
/*
* jQuery autoResize (textarea auto-resizer)
* @copyright James Padolsey http://james.padolsey.com
* @version 1.04
*/
(function($){
$.fn.autoResize = function(options) {
@fundon
fundon / gist:756918
Created December 28, 2010 05:15
Dom Events
Dom Events 注册&触发
IE: 先进后出
Other: 先进先出
@fundon
fundon / gist:764336
Created January 4, 2011 03:15
抽象工厂模式(Abstract Factory)
function AbstractFactory(){
this.createButton = function(){};
this.createBorder = function(){};
};
function Button(){};
function Border(){};
function WinFactory(){};
function MacFactory(){};
@fundon
fundon / gist:765901
Created January 5, 2011 03:48
简单工厂模式(Simple Factory)
// javascript
function Shape(){};
Shape.prototype.draw = function(){};
function Circle(){};
Circle.prototype = new Shape();
function Square(){};
Square.prototype = new Shape();

IMPORTANT! Wikified version of this page may be found here. Feel free to edit. :)

Note that since it's kind of PITA to merge changes from other gists it's recommended that you do your changes directly to the wiki!

Game Engines

Name Latest Release Size (KB) License Type Unit Tests Docs Notes
Akihabara 1.3 GPL2/MIT Classic Repro Intended for making classic arcade-style games in JS+HTML5 3
Aves Commercial? Obsolete. Company bought by Zynga.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
Grab latest ubuntu 11.04 64bit canonical ami from alestic - http://alestic.com/
Create new ec2 instance + add ebs volume (/dev/sdf) + elastic ip
# update hostname + /etc/host
sudo hostname fe1-us.dustinwhittle.net
# add user account + configure keys in sshd_config + add ssh key
@fundon
fundon / socket_redis_v1.py
Created May 27, 2011 09:16
Simple use socket connect redis
#!/usr/bin/env python
import socket, time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 6379))
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
time.sleep(2)
sock.sendall('PING\r\n')
print repr(sock.recv(4096))
time.sleep(2)
@fundon
fundon / qqip.py
Created May 28, 2011 09:31
get ip
#!/usr/bin/env python
import urllib
print urllib.urlopen("http://fw.qq.com/ipaddress").read().decode('gbk').encode('utf8')
#output: var IPData = new Array("180.168.84.109","","上海市","");