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
## My alias | |
# mkpass - Generate random string with 12 chars | |
alias mkpass='python -c "import random, string; print \"\".join(random.choice(string.ascii_letters + string.digits + \"[]\") for x in range(12))"' | |
## Virtualenvwrapper Settings | |
VIRTUALENVWRAPPER=`which virtualenvwrapper.sh` | |
export WORKON_HOME=$HOME/.virtualenvs | |
if [ -f ${VIRTUALENVWRAPPER} ]; then |
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 sublime, sublime_plugin | |
import datetime | |
class Command(sublime_plugin.TextCommand): | |
def run(self, edit): | |
doc = """/* | |
Author: <Auhtor name> | |
Date: %s | |
Description: | |
*/ |
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
Show hidden characters
{ | |
"font_size": 8, | |
"tab_size": 2, | |
"word_wrap": false, | |
"translate_tabs_to_spaces": true, | |
"rulers": [80, 120] | |
} |
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 | |
# Project information | |
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__)) | |
PROJECT_NAME = os.path.basename(PROJECT_PATH) | |
# Helpers | |
path = lambda *p: os.path.join(PROJECT_PATH, *p) | |
# Debug |
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 django.conf import settings | |
from django.conf.urls import patterns, include, url | |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
# from django.contrib import admin | |
# admin.autodiscover() | |
urlpatterns = patterns('', | |
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), |
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
# Nginx | |
server { | |
# [...] | |
server_name *.yourdomain.com; | |
# [...] | |
} |
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 SubdomainURLRoutingMiddleware(SubdomainMiddleware): | |
def process_request(self, request): | |
super(SubdomainURLRoutingMiddleware, self).process_request(request) | |
subdomain = getattr(request, 'subdomain', False) | |
if subdomain is not False and subdomain not in settings.SUBDOMAIN_BLACKLIST: | |
# Here is the trick. I will put at the first rule the users url | |
# set at the settings, this way, the first page will be the | |
# user page matched with subdomain. |
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
# I have not tested, only didactic. | |
# | |
# signals.py | |
# | |
from django.core.mail import EmailMultiAlternatives | |
from django.template.loader import render_to_string | |
def send_notification_mail(sender, instance, raw, using): | |
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
# Sublime Features | |
SublimeLinter | |
ColorPicker | |
Package Control | |
# Html | |
HTMLAttributes | |
HtmlTidy | |
# JavaScript |
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
python -c 'from django.utils.crypto import get_random_string; print "\nSECRET_KEY = \"%s\"\n" % get_random_string(50, "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)")' |
OlderNewer