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
import os, subprocess | |
from webassets.filter import Filter | |
class SassFilter(Filter): | |
"""Converts `Sass <http://sass-lang.com/>`_ markup to real CSS. | |
""" | |
name = 'sass' |
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
SOCIAL_DETAILS = None | |
def soul_catcher(sender, uid, response, details, **kwargs): | |
global SOCIAL_DETAILS | |
SOCIAL_DETAILS = details | |
socialauth_not_registered.connect(soul_catcher, sender=None) | |
@render_to("account/signup.html") | |
def register(request, backend): |
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
Calculates the total number of downloads that a particular PyPI package has | |
received across all versions tracked by PyPI | |
""" | |
from datetime import datetime | |
import locale |
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 social_auth.backends.facebook import FacebookBackend | |
from social_auth.backends import google | |
def social_extra_values(sender, user, response, details, **kwargs): | |
result = False | |
if "id" in response: | |
from apps.photo.models import Photo | |
from urllib2 import urlopen, HTTPError | |
from django.template.defaultfilters import slugify |
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
import sys, os | |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), | |
"../")) | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') | |
from django.core import serializers | |
from django.db.models import get_model | |
from django.template.defaultfilters import slugify | |
MODELS_TO_DUMP = ( |
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
"""Implements HttpdLog Class for gathering useful info from nginx/apache access logs. | |
""" | |
import re | |
from datetime import timedelta, datetime | |
import subprocess | |
__author__ = "Dmitry Chaplinsky" | |
__copyright__ = "Copyright 2012, Dmitry Chaplinsky" | |
__credits__ = [] |
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 python | |
import sys | |
import os.path | |
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) | |
sys.path.insert(0, os.path.join(PROJECT_ROOT, "../")) | |
from twisted.internet import reactor, task | |
from scrapy.crawler import Crawler |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Blackboard</string> | |
<key>author</key> | |
<string>Domenico Carbotta</string> | |
<key>settings</key> | |
<array> |
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 scrapy.contrib.exporter import XmlItemExporter | |
class DictXmlItemExporter(XmlItemExporter): | |
def _export_xml_field(self, name, serialized_value): | |
self.xg.startElement(name, {}) | |
if hasattr(serialized_value, '__iter__'): | |
if isinstance(serialized_value, dict): | |
for key in serialized_value: | |
self._export_xml_field(key, serialized_value[key]) |