This file contains 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 render_to_response(self, context, **response_kwargs): | |
from django.conf import settings | |
STATIC_URL = settings.STATIC_URL | |
if 'http' not in STATIC_URL: | |
# wkhtmltopdf requires full uri to load css | |
from urlparse import urlparse | |
parsed = urlparse(self.request.META.get('HTTP_REFERER')) | |
parsed = '{uri.scheme}://{uri.netloc}'.format(uri=parsed) | |
context["STATIC_URL"] = "{}{}".format(parsed, settings.STATIC_URL) |
This file contains 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
#!/usr/bin/env pypy | |
import time | |
n = 13 | |
# n = 1000000 | |
if __name__ == "__main__": |
This file contains 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 datetime import date | |
from datetime import timedelta | |
import copy | |
# ported from npmjs epi-week package | |
# https://github.com/wombleton/epi-week | |
# | |
#getFirstWeek = (year) -> | |
# end = new Date(year, 0, 1) |
This file contains 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
<!-- new_base.html --> | |
<header> | |
{% block header %} | |
{% endblock %} | |
</header> | |
<main id="content" class="group" role="main"> | |
{% block main %} | |
<div id="main-container" class="main-container container"> |
This file contains 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
find . -name "*.html" -print0 | xargs -0 sed -i "" 's/ url \([^" >][^ >]*\)/ url "\1"/g' |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
#!/bin/sh | |
pg_ctl -D /usr/local/var/postgres start |
This file contains 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
image_url = og.get('image') | |
if image_url: | |
import urllib2 | |
from django.core.files import File | |
from django.core.files.temp import NamedTemporaryFile | |
img_temp = NamedTemporaryFile(delete=False) | |
img_temp.write(urllib2.urlopen(image_url).read()) | |
img_temp.flush() | |
import os |
This file contains 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
{% for p in period_list %} | |
{# or Try regroup p.subject_periods.subject #} | |
{% for sp in p.subject_periods.all %} | |
{# or Try regroup sp.subject #} |
This file contains 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
DEBUG = True | |
TEMPLATE_DEBUG = True | |
COMPRESS_ENABLED = False | |
DATABASES = { | |
"default": { | |
"ENGINE": "django.db.backends.sqlite3", | |
"NAME": "dev.db", | |
} | |
} |
NewerOlder