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
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
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
if [ -e /etc/sudoers.tmp -o "$(pidof visudo)" ]; then
echo $(pidof visudo)
echo "/etc/sudoers busy, try again later"
exit 1
fi
cp -p /etc/sudoers /etc/sudoers.bak
cp -p /etc/sudoers /etc/sudoers.tmp
line="%wheel ALL=(ALL) ALL"
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):
@calvinchengx
calvinchengx / gist:2641756
Created May 9, 2012 04:16
Why the weird warning?
calvin$ python setup.py register
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running register
running check