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
# very simple git revision based cache buster | |
app = make_app() | |
def get_git_revision_hash(): | |
''' | |
Get current revision short hash and use as cache buster key. | |
''' | |
import subprocess | |
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']) |
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
import logging | |
import pylibmc | |
from werkzeug.contrib.cache import MemcachedCache | |
from flask import request | |
from flask.ext.cache import Cache | |
log = logging.getLogger(__name__) |
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
class root.utils.ViewportHeight | |
'The VH unit is not well supported. Use data-tags instead. | |
data-viewport-unit="line-height: 100vh; height: 100vh;' | |
constructor: ({@element, @styles}={}) -> | |
@$element = $ @element | |
@$window = $ window | |
@_bindHandlers() | |
_getStyles: -> |
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; | |
} | |
} |
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
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
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
''' | |
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
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): |