Skip to content

Instantly share code, notes, and snippets.

@lauryl
lauryl / mixins.scss
Last active December 16, 2015 22:49
This splits a css property into separate variables depending on the media query. Importing this mixin avoids having to write out the @media declaration. In its place is one line for an @include. This makes use of SASS 3.2 by using variables to define @media values.
@mixin block_width() {
// Device widths
$view_small: 320px;
$view_med: 568px;
$view_max: 1200px;
// Element widths
$small: 200px;
$med: 290px;
@lauryl
lauryl / gist:5509579
Created May 3, 2013 14:50
Show content (in this case, a promo code for cyber monday) for 24 hours
@register.inclusion_tag('templatetags/global_promo.html', takes_context = True)
def current_promo(context):
context.update({'discount_code': Promo.objects.filter(parent_promo__isnull=True)})
import datetime
from datetime import date
from datetime import time
current_date = datetime.date.today()
promo_date = datetime.date(2012, 11, 26)