This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def db_default(field, db_default): | |
""" | |
Set attribute __db_default for signal to set default values with. | |
""" | |
if db_default == '': | |
db_default = "''" | |
field.__db_default = db_default | |
return field | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(function() { | |
var API_KEY = '2132d453ab3cc055308fb40c708ea412'; | |
$(".set").each(function() { | |
var set_id = $(this).find('a.flickr-set').attr('rel'); | |
url = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=' + API_KEY + '&per_page=48&page=1&format=json&jsoncallback=?&photoset_id=' + set_id; | |
var selector = $(this); | |
data = $.getJSON(url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python to_base64.py some_file | |
""" | |
import sys | |
import os | |
def main(path): | |
with open(path) as f: | |
sys.stdout.write(f.read().encode('base64').replace('\n', '')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.forms.models import model_to_dict | |
from django import forms | |
class OverwriteOnlyModelFormMixin(object): | |
''' | |
Delete POST keys that were not actually found in the POST dict | |
to prevent accidental overwriting of fields due to missing POST data. | |
''' | |
def clean(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Django doesn't ship with a way to use the template loading framework to output raw source. | |
It's kinda important since we use the framework to walk the template dirs | |
''' | |
import inspect | |
from django.conf import settings | |
from django.template.loader import find_template_loader | |
from django.template import TemplateDoesNotExist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install python-software-properties python g++ make | |
sudo add-apt-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs | |
npm -g install bower |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_html_mail(subject, message, message_html, from_email, recipient_list, | |
priority="medium", fail_silently=False, auth_user=None, | |
auth_password=None, account=0, attachments=None, headers=None): | |
""" | |
Ripped out of mailer.. does not accept headers. | |
""" | |
from django.utils.encoding import force_unicode | |
from django.core.mail import EmailMultiAlternatives |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (grunt) -> | |
srcBase = "v2/frontend" | |
grunt.initConfig | |
# config: | |
paths: | |
phpBase: "public_html" | |
src: "public_html/v2/frontend" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$grid_columns: 12; | |
@mixin responsive-gutters { | |
padding-right: $touch-gutter/2; | |
padding-left: $touch-gutter/2; | |
@include breakpoint($bp-desktop) { | |
padding-right: $desktop-gutter/2; | |
padding-left: $desktop-gutter/2; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$grid_columns: 12; | |
@mixin responsive-gutters { | |
padding-right: $touch-gutter/2; | |
padding-left: $touch-gutter/2; | |
@include breakpoint($bp-desktop) { | |
padding-right: $desktop-gutter/2; | |
padding-left: $desktop-gutter/2; | |
} | |
} |