Skip to content

Instantly share code, notes, and snippets.

View calvinchengx's full-sized avatar
:octocat:
Focusing

Calvin Cheng calvinchengx

:octocat:
Focusing
View GitHub Profile
[Session started at 2011-03-09 20:56:30 +0800.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1510) (Fri Oct 22 04:12:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys001
Loading program into debugger…
Program loaded.
Process: Safari [21106]
Path: /Applications/Safari.app/Contents/MacOS/Safari
Identifier: com.apple.Safari
Version: 5.0.4 (6533.20.27)
Build Info: WebBrowser-75332027~1
Code Type: X86-64 (Native)
Parent Process: launchd [204]
Date/Time: 2011-03-15 17:22:44.776 +0800
OS Version: Mac OS X 10.6.6 (10J567)
Process: Safari [22389]
Path: /Applications/Safari.app/Contents/MacOS/Safari
Identifier: com.apple.Safari
Version: 5.0.4 (6533.20.27)
Build Info: WebBrowser-75332027~1
Code Type: X86-64 (Native)
Parent Process: launchd [204]
Date/Time: 2011-03-15 21:22:18.479 +0800
OS Version: Mac OS X 10.6.6 (10J567)
@calvinchengx
calvinchengx / IllustratorLayerAsPNG.jsx
Created April 25, 2011 07:57
Export each layer as a PNG from your Illustrator file.
var document = app.activeDocument;
if(document && folder)
{
var options = new ExportOptionsPNG24();
options.antiAliasing = true;
options.transparency = true;
var n = document.layers.length;
for(var i=0; i<n; ++i)
{
@calvinchengx
calvinchengx / tests.py
Created February 29, 2012 06:27
Example of how selenium is used in my unit tests
import urlparse
from selenium import webdriver
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
class BackendsTest(TestCase):
def setUp(self):
#!/bin/sh
#####################
# Arch Linux
#####################
[ "$UID" != 0 ] && su=sudo
country='Singapore'
url="http://www.archlinux.org/mirrorlist/?country=$country&protocol=ftp&protocol=http&ip_version=4&use_mirror_status=on"
Press ENTER or type command to continue
#!/bin/sh
#####################
# Mac OS X
#####################
# Mac personal apps
# TODO: use wget to automate these :-)
# manually download and install skype
@calvinchengx
calvinchengx / fabfile.py
Created April 13, 2012 09:25
fabfile.py (in progress)
from fabric.api import local, env, run
from fabric.context_managers import prefix
# we need to do this to ensure that mkvirtualenv and other bash commands are available
# this is because fabric uses /bin/sh by default and hence have no access to virtualenv cmds.
env.activate = 'source ~/.bash_profile; source `which virtualenvwrapper.sh`;'
def start(name="project"):
print("Creating a new django project named `{0}`.".format(name))
print("Creating virtualenv `{0}` for this project.".format(name))
function mycoolajaxCall(csrfmiddlewaretoken, whateverla) {
post_data = {csrfmiddlewaretoken: csrfmiddlewaretoken,
whateverla: whateverla}
$.ajax({
url: the_url,
data: post_data,
type: 'POST',
dataType: 'json',
success: function (data) {
alert("Success! You are so cool, my friend.")
class PaypalFactory(factory.Factory):
FACTORY_FOR = Paypal
class BankdraftFactory(factory.Factory):
FACTORY_FOR = Bankdraft
class BanktransferFactory(factory.Factory):
FACTORY_FOR = Banktransfer