Skip to content

Instantly share code, notes, and snippets.

@cyeong
cyeong / pre-commit.sh
Created December 10, 2012 08:30 — forked from milancermak/pre-commit.sh
Python pre-commit hook
#!/bin/sh
# make sure requirements.txt is up to date with every commit
# by comparing the output of pip freeze
pip freeze | diff requirements.txt - > /dev/null
if [ $? != 0 ]
then
echo "Missing python module dependencies in requirements.txt. Run 'pip freeze > requirements.txt' to update."
exit 1
fi
@cyeong
cyeong / feature ship
Created December 17, 2012 03:48
the commit ship
,:',:`,:'
__||_||_||_||__
____["""""""""""""""]____
\ " '''FEATURE'''''''''' \
^~^~^^~^~^~^~^~^~^~^~^~^~^~^~~^~^~^^~~^~^
@cyeong
cyeong / Vim Tricks
Created January 10, 2013 07:35
Vim tricks
==================================
||||AT NETRW DIRECTORY LISTING||||
==================================
press % at file selection screen(not sure what that's called) to create and open new file
press d for new directory
@cyeong
cyeong / gist:4720684
Last active December 12, 2015 05:18
Deploy process
#at develop branch
git tag
git flow release start [ver number]
git flow release finish [ver number]
#will end up at master, update it by pulling if necessary, and then push
fab deploy:prod
fab uwsgi:prod,restart
./manage.py migrate --list --settings=greedychimp.settings.prod
#and migrate
{% extends "base.html" %}
{% block title %}Test django-paypal cart{% endblock %}
{% block content %}
<h1>Testing django-paypal cart</h1>
{{ form.render }}
{% endblock %}
@cyeong
cyeong / macterminalshortcut.txt
Created February 24, 2013 13:41
Mac Terminal Shortcuts
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
@cyeong
cyeong / gist:5028551
Created February 25, 2013 08:48
migration problem
if there's a migration problem and you could not rollback nor advance the migration, try doing this
All the migrations, that have previously been triggered are stored in the database in a table called south_migrationhistory.
The migrations that are saved inside this table are not going to be triggered anymore. So if you want to run them again, you have to delete their records from that table.
If you're using MySQL this can be done through PhpMyAdmin, if using PgSQL, through PgAdmin III. You can also do this through the Django Project management shell.
python manage.py shell
from south.models import MigrationHistory
@cyeong
cyeong / Test Paypal
Created February 28, 2013 07:39 — forked from nychng/Test Paypal
def test_paypal_callback(self):
response = self.client.login(username=self.user.email, password='foz')
self.assertTrue(response)
# create post params simulation from paypal
order = OrderFactory(event=self.event, cart=self.cart,
payment_method=self.payment_method)
total = '%.2f' % self.total
post_param = {
This file has been truncated, but you can view the full file.
'use strict';
var COMPILED = !0, goog = goog || {};
goog.global = this;
goog.DEBUG = !1;
goog.LOCALE = "en";
goog.provide = function (a) {
if (!COMPILED) {
if (goog.isProvided_(a))
throw Error('Namespace "' + a + '" already declared.');
@cyeong
cyeong / gist:5299550
Created April 3, 2013 08:48
python inline for if else
[item for item in items if cond]
[item if cond else something_else for item in items]