Skip to content

Instantly share code, notes, and snippets.

View skoczen's full-sized avatar

Steven Skoczen skoczen

View GitHub Profile
import os
from utils import show_valid, warn, error, note
from clint.textui import puts, indent, columns
from urlparse import urlparse
def import_settings(quiet=True):
"""This method takes care of importing settings from the environment, and config.py file.
Order of operations:
'/Users/skoczen/.virtualenvs/core/bin',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/Users/skoczen/.virtualenvs/core/lib/python27.zip',
'/Users/skoczen/.virtualenvs/core/lib/python2.7',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/plat-darwin',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/plat-mac',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/lib-tk',
'/Users/skoczen/.virtualenvs/core/lib/python2.7/lib-old',
@skoczen
skoczen / migrate.py
Created August 3, 2012 17:02
Heroku shared-database to dev migration helper
#!python
# Run this file to upgrade your shared database to a dev plan.
# Make sure you're using the heroku gem >= 2.30.1
# Usage: python migrate.py
# Follow the interactive prompts.
import sys
import subprocess
def remove_shared_database_after_confirmation(app_name):
heroku addons:add zerigo_dns:tier1
----> Adding zerigo_dns:tier1 to good-schools... failed
! Zerigo DNS: The current service plan only allows 10 total host records.
@skoczen
skoczen / gist:1224417
Created September 17, 2011 22:02
a few stripe-y methods
@property
def stripe_customer(self):
stripe.api_key = settings.STRIPE_SECRET
if not self.stripe_customer_id:
if not self.free_trial_ends_date:
if datetime.datetime.now() > self.signup_date + datetime.timedelta(days=30):
# They signed up pre-stripe
self.free_trial_ends_date = datetime.datetime.now() + datetime.timedelta(minutes=1)
else:
self.free_trial_ends_date = self.signup_date + datetime.timedelta(days=30)