Skip to content

Instantly share code, notes, and snippets.

@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active April 11, 2024 03:35
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@fohlin
fohlin / forms.py
Created January 8, 2011 18:50
A version of Django's UserCreationForm that uses email instead of username, with some nifty features. (Maybe not super robust yet, in terms of concurrency...)
import re
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UniqueUserEmailField(forms.EmailField):
"""
An EmailField which only is valid if no User has that email.
"""
def validate(self, value):