Skip to content

Instantly share code, notes, and snippets.

gorhack / postactivate.bash
Last active Jan 8, 2016
Enter/Exit virtual environment when workon/deactiavated
View postactivate.bash
# This hook is sourced after every virtualenv is activated.
PROJECT_DIR="$HOME/Documents/Development/virtualenvs/$(basename $VIRTUAL_ENV)"
if [ -d $PROJECT_DIR ]; then
# If we aren't already within the project dir, cd into it
if [[ ! `pwd` == "$PROJECT_DIR*" ]]; then
gorhack / .bash_profile
Last active Jan 8, 2016
modify bash_profile on Mac OS X to work with virtual environments
View .bash_profile
export WORKON_HOME=~/Documents/Development/virtualenvs
source /usr/local/bin/
gorhack / README.rst
Last active Dec 28, 2015 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText
View README.rst

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

import requests
from io import BytesIO
def genCatImage():
generates an image from TheCatAPI and returns the image as a Byte stream
# get image from website
r = requests.get('')
if r.status_code == # image returned OK
gorhack / AppDelegate.swift
Last active Dec 26, 2015
File additions to implement Facebook SDK with Swift 2
View AppDelegate.swift
import FBSDKShareKit
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)