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 asyncio | |
import typing | |
import emcache | |
from aiocache.base import BaseCache | |
from aiocache.serializers import BaseSerializer | |
import settings | |
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 csv | |
from io import StringIO | |
from django.db import connection | |
from psycopg2 import sql | |
def copy_from(model, columns, records): | |
""" | |
copy_from( |
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
if os.environ.get('DEBUG_SQL') or os.environ.get('DEBUG_SQL_TRACEBACK'): | |
LOGGING['loggers']['django.db.backends'] = { | |
'level': 'DEBUG', | |
'handlers': ['console'], | |
'propagate': False, | |
} | |
if os.environ.get('DEBUG_SQL_TRACEBACK'): | |
import traceback | |
import logging |
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
(function () { | |
'use strict'; | |
function toLower(s) { | |
return s.toLowerCase(); | |
} | |
function makeArray(length) { | |
return Array.from(new Array(length), (x,i) => i); | |
} |
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
# coding=utf-8 | |
# from cashculator export to debit & credit import | |
import csv | |
file_name = 'out.csv' | |
def convert_date(date): | |
data = { |
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
$ '#id_rating' | |
.barrating( | |
wrapperClass: 'rating-bar' | |
showSelectedRating: false | |
initialRating: 5 | |
) |
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
class RedirectSeoMiddleware(object): | |
""" | |
Insert before django.middleware.common.CommonMiddleware | |
""" | |
def process_request(self, request): | |
if not request.path.endswith('/'): | |
try: | |
view, args, kwargs = resolve(request.path + '/') | |
kwargs['request'] = request | |
view(*args, **kwargs) |
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 app.config import TWITTER_APP_KEY, TWITTER_APP_SECRET | |
twitter_oauth = oauth.remote_app( | |
'twitter', | |
consumer_key=TWITTER_APP_KEY, | |
consumer_secret=TWITTER_APP_SECRET, | |
base_url='https://api.twitter.com/1.1/', | |
request_token_url='https://api.twitter.com/oauth/request_token', |