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 import forms | |
from django.core.exceptions import ValidationError | |
from apps.merchant.models import Merchant | |
from views.form_fields import XEDateRangeField | |
class IntegerCSVField(forms.CharField): | |
def __init__(self, min_value=None, max_value=None, *args, **kwargs): | |
super().__init__(**kwargs) |
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
""" | |
# https://gist.github.com/joncombe/a208be990d7b98c15b8dbf5475eb75c3 | |
{% load thai_phone %} | |
{{ landline|thai_phone }} # 02 123 4567 | |
{{ mobile|thai_phone }} # 081 234 5678 | |
{{ mobile|thai_phone:'-' }} # 081-234-5678 | |
""" |
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
""" | |
Please don't use this for PHP-esque in template treachery. It fixed an emergency I had. Maybe it can for you too. | |
Output a string... | |
{% setting "FOO.BAR" %} | |
Use in an expression... | |
{% setting "FOO.BAR" as foobar %} | |
{% if foobar %}yeah!{% else %}boo!{% endif %} |
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 math | |
import os | |
from PIL import Image, ImageDraw | |
""" | |
A very simple script to generate a row of star images which can be | |
used in a rating indicator (e.g. 4 out of 5 stars), and some css to | |
go with it.. | |
Usage example: |
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
# get latest .bash_aliases file (you will need to logout and log back in to use it) | |
updateba() { | |
cd ~ | |
rm .bash_aliases | |
wget https://gist.githubusercontent.com/joncombe/94b099d545a18cb970f8/raw/.bash_aliases --no-cache | |
} | |
# ng serve with host and default port | |
alias ngs='ng serve --host 0.0.0.0 --port 8001' | |
alias ngsp='ng serve --host 0.0.0.0 --disable-host-check --live-reload-client http://0.0.0.0:8001 --port 8001 --proxy-config proxy.conf.json' |
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
# https://docs.djangoproject.com/en/1.6/ref/contrib/gis/install/geolibs/ | |
sudo apt-get install binutils libproj-dev gdal-bin | |
# http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list' | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-9.3 postgresql-9.3-postgis pgadmin3 postgresql-contrib | |
# https://docs.djangoproject.com/en/1.6/ref/contrib/gis/install/postgis/ |
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
/* | |
License: | |
Jookie 1.0 jQuery Plugin | |
Copyright (c) 2009 Jon Combe (http://joncom.be) | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, |
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
/* | |
License: | |
Tache 1.0 jQuery Plugin | |
Copyright (c) 2008 Jon Combe (http://joncom.be) | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, |
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
function PieChart(iMiddleX, iMiddleY, iRadius, | |
iExplodeDistance, bShowShadow, iDonutRadius, aData) { | |
// draw shadow | |
if (bShowShadow == true) { | |
var iStartAngle = 0; | |
var iShadowOffset = (iRadius / 45); | |
for (var i = 0; i < aData.length; i++) { | |
iStartAngle = DrawSlice(oColors.shadow, | |
iMiddleX + iShadowOffset, | |
iMiddleY + iShadowOffset, |