To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
- Homebrew
- Mountain Lion -> High Sierra
To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
| from functools import wraps | |
| from routers import ForceReadForModelsRouter | |
| __all__ = ['uses_forced_read_router'] | |
| def uses_forced_read_router(func): | |
| @wraps(func) | |
| def wrapper(req, *args, **kwargs): |
| def get_cache_key(model, pk): | |
| """ | |
| Generates a cache key based on ``WRITE_CACHE_PREFIX``, the cache key prefix | |
| defined in the settings file (if any), the Django app and model name, and | |
| the primary key of the object. | |
| """ | |
| params = { | |
| 'prefix': getattr(settings, 'WRITE_CACHE_PREFIX', ''), | |
| 'app': model._meta.app_label, | |
| 'model': model._meta.object_name, |
| import multiprocessing | |
| # Turn on debugging in the server. [False] | |
| debug=True | |
| # Install a trace function that spews every line executed by the server. [False] | |
| spew=False | |
| # The Access log file to write to. [None] | |
| #accesslog='/var/log/gunicorn.access.log' |
| from django.test import TestCase, RequestFactory | |
| from django.views.generic import TemplateView | |
| from ..lib.views import YourMixin | |
| class YourMixinTest(TestCase): | |
| ''' | |
| Tests context-data in a Django Mixin like a boss | |
| ''' |
I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.
I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| package main | |
| import ( | |
| "net/http" | |
| ) | |
| type SingleHost struct { | |
| handler http.Handler | |
| allowedHost string | |
| } |
| @media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ } | |
| @media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ } | |
| @media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ } | |
| @media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ } | |
| @media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ } | |
| @media (min-width:1281px) { /* hi-res laptops and desktops */ } |