"easeInSine": cubic-bezier(0.12, 0, 0.39, 0),
"easeOutSine": cubic-bezier(0.61, 1, 0.88, 1),
"easeInOutSine": cubic-bezier(0.37, 0, 0.63, 1),
"easeInQuad": cubic-bezier(0.11, 0, 0.5, 0),
"easeOutQuad": cubic-bezier(0.5, 1, 0.89, 1),
"easeInOutQuad": cubic-bezier(0.45, 0, 0.55, 1),
"easeInCubic": cubic-bezier(0.32, 0, 0.67, 0),
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
cat access.log | grep 404 | awk '{print $7}' | sort | uniq -c | sort -nr | head -n 100 |
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
find . -type d -name "node_modules" -prune -exec du -sh {} \; | sort -nrk1 | |
# find directories matching the name `node_modules` | |
# prune out unnecessary entries from within top-level `node_modules` results | |
# run `du` against the results to calculate size | |
# pipe to sort, first column as key, reverse natural |
This provides a new site with a unique IAM access key/secret that allows read/write access to a single S3 bucket, e.g. to allow a Django site to upload media files. This assumes the bucket itself has already been created.
Note: I originally created this gist as a note-to-self so conventions shown here are particular to my setup; YMMV.
- Log in to the AWS Console and head to the IAM section
- Click Users to access the IAM user list
- Click Add User
- Enter username in the format of
sitename-s3
(replacingsitename
)
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.core.management.base import BaseCommand, CommandError | |
from os.path import join | |
from urllib import urlretrieve | |
class Command(BaseCommand): | |
help = 'Imports translations from Loco' | |
def handle(self, *args, **options): |
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
""" | |
This uses the DB to ensure uniqueness of the code. Better than checking separately | |
with the DB and then saving, which introduces a race condition. | |
""" | |
class UserProfile(BaseModel): | |
code = models.CharField(max_length=4, | |
db_index=True, | |
unique=True) | |
def generate_code(self): |
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
""" | |
WSGI config for myproject project. | |
It exposes the WSGI callable as a module-level variable named ``application``. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ | |
""" | |
import os |
I hereby claim:
- I am BigglesZX on github.
- I am biggleszx (https://keybase.io/biggleszx) on keybase.
- I have a public key whose fingerprint is 0361 EC11 E816 C0A0 C151 859B 36CB 1F0D BFFB 46BF
To claim this, I am signing this object:
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
web: django-admin.py collectstatic --noinput; newrelic-admin run-program gunicorn appname.wsgi:application -b "0.0.0.0:$PORT" -w 4 |
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 localStorage isn't available but IE's userData API is, polyfill it | |
// polyfill pattern based on https://gist.github.com/juliocesar/926500 | |
if (Modernizr && !Modernizr.localstorage) { | |
// set up storage element | |
var storageNamespace = 'localStoragePolyfill', | |
storage = document.createElement('div'); | |
if (typeof storage.addBehavior !== 'undefined') { | |
storage.id = '_storage'; | |
storage.style.display = 'none'; | |
storage.style.behavior = 'url("#default#userData")'; |
NewerOlder