A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
var moduleName = 'uploadfile' | |
angular.module(moduleName, []) | |
.controller('UploadController', ['$scope', '$http', 'UploadFileService', function ($scope) { | |
$scope.$watch('file', function (newfile, oldfile) { | |
if (angular.equals(newfile, oldfile)) { | |
return; | |
} | |
// UploadFileService.upload(newfile).then(function (res) { |
import base64 | |
import binascii | |
import uuid | |
from django.core.exceptions import ValidationError | |
from django.core.files.base import ContentFile | |
from django.utils import six | |
from django.utils.translation import ugettext_lazy as _ | |
from rest_framework.fields import ( | |
DateField, |
With argument | |
"C:\Program Files\Git\git-bash.exe" "--cd=%1" | |
Direct | |
"C:\Program Files\Git\git-bash.exe" "--cd="C:\YOUR\FOLDER\" |
// takes the form field value and returns true on valid number | |
function valid_credit_card(value) { | |
// accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
var nCheck = 0, nDigit = 0, bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; n--) { |
""" | |
Django settings for subscriptions project. | |
Generated by 'django-admin startproject' using Django 1.10.6. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/1.10/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/1.10/ref/settings/ |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: redis | |
spec: | |
ports: | |
- port: 6379 | |
name: redis | |
clusterIP: None | |
selector: |
# How to user | |
# configure_proxy_postgres_gke.sh <PATH_TO_KEY_FILE> <INSTANCE_CONNECTION_NAME> | |
if [$1 == ""] | |
then | |
echo "<PATH_TO_KEY_FILE required>!" | |
echo "configure_proxy_postgres_gke.sh <PATH_TO_KEY_FILE> <INSTANCE_CONNECTION_NAME>" | |
exit | |
fi | |
if [$2 == ""] |
if [$1 == ""] | |
then | |
echo "<APP> required!" | |
echo "deploy.sh <APP> <VERSION>" | |
exit | |
fi | |
if [$2 == ""] | |
then | |
echo "<VERSION> required!" |