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 django.conf import settings | |
from django.template.loader import render_to_string | |
from mailer.models import Message | |
from mailer import PRIORITY_MAPPING | |
subject = settings.EMAIL_SUBJECT_PREFIX + u'Pending Registrations' | |
priority = PRIORITY_MAPPING['high'] | |
context = { |
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
$ git push tsuru master | |
Counting objects: 5, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (2/2), done. | |
Writing objects: 100% (4/4), 414 bytes, done. | |
Total 4 (delta 0), reused 0 (delta 0) | |
remote: / | |
remote: / | |
remote: Reading package lists... | |
remote: Building dependency tree... |
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 base64 | |
import os | |
from tastypie.fields import FileField | |
from django.core.files.uploadedfile import SimpleUploadedFile | |
class Base64FileField(FileField): | |
""" | |
A django-tastypie field for handling file-uploads through raw post data. | |
It uses base64 for en-/decoding the contents of the file. | |
Usage: |
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 os.path import splitext | |
from django.core.exceptions import ValidationError | |
from django.utils.translation import ugettext_lazy as _ | |
from django.template.defaultfilters import filesizeformat | |
class FileValidator(object): | |
""" | |
Validator for files, checking the size, extension and mimetype. |
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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'standard': { | |
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s' | |
}, | |
}, | |
'handlers': { | |
'default': { |
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 pip | |
try: | |
from setuptools import setup, find_packages | |
except ImportError: | |
from distutils.core import setup, find_packages | |
links = [] # for repo urls (dependency_links) | |
requires = [] # for package names |
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
import os | |
import binascii | |
binascii.hexlify(os.urandom(24)) |
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
# pip install selenium | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
driver = webdriver.Firefox() | |
driver.get("http://127.0.0.1:5000/admin/login/") | |
driver.maximize_window() | |
input_login = driver.find_element_by_id('email') |
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 () { | |
$('#modal-id').on('shown', function () { | |
/* add code here to be executed when modal is displayed */ | |
}); | |
$('#modal-id').on('hidden', function () { | |
/* the next line will remove from DOM the content of the modal body */ | |
$(this).removeData('modal'); | |
}); | |
}); |
OlderNewer