This file contains hidden or 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 urllib | |
try: | |
from urlparse import parse_qs | |
except ImportError: | |
from cgi import parse_qs | |
def url_params(url, **kwargs): | |
bits = url.split('?') | |
query_vars = {} | |
if len(bits) > 1: |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>myvmname.virtualbox</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/VBoxHeadless</string> |
This file contains hidden or 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 email.utils import formatdate | |
from email.message import Message | |
from email.mime.text import MIMEText | |
import smtplib | |
import textwrap | |
def send_email(to_address, to_name, from_address, from_name, subject, body, **kwargs): | |
msg = MIMEText(body) | |
msg['To'] = '%s <%s>' % (to_name, to_address) | |
msg['From'] = '%s <%s>' % (from_name, from_address) |
This file contains hidden or 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
<div class="form_row{% if field.errors %} has_errors{% endif %}{% if class %} {{ class }}{% endif %}{% if field.field.required %} required{% endif %}"> | |
<label for="{{ field.auto_id }}"> | |
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %} | |
{% if field.field.required %}<span>(required)</span>{% endif %} | |
</label> | |
{{ field }} | |
{% if field.errors %} | |
<p class="error">{{ field.errors|join('<br>') }}</p> | |
{% endif %} | |
{% if help_text %} |
This file contains hidden or 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
# A test runner that doesn't require a database, and then reports coverage of your Django apps | |
# Usage: in settings.py, add: | |
# TEST_RUNNER="path.to.nodb_coverage_testrunner.run_tests" | |
import os | |
import unittest | |
from glob import glob | |
from django.test.utils import setup_test_environment, teardown_test_environment | |
from django.conf import settings |
This file contains hidden or 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
def get_class(class_to_get, *args, **kwargs): | |
"""Will get the class regardless of whether it's a module or not: | |
>>> get_class('module.MyClassName') | |
MyClassName() | |
""" | |
try: | |
dot = class.rindex('.') | |
except ValueError: | |
pass | |
else: |
This file contains hidden or 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 gets around Emacs 23.1 for OS X clobbering the Alt key on a UK keyboard | |
(global-set-key (kbd "M-3") 'insert-hash) | |
(defun insert-hash () | |
(interactive) | |
(insert "#")) |
This file contains hidden or 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
#!/bin/sh | |
FOO="Hello, world" | |
`exec erl -kernel bar "${FOO}"` |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
djangojinja2 | |
~~~~~~~~~~~~ | |
Adds support for Jinja2 to Django. | |
Configuration variables: | |
======================= ============================================= |
This file contains hidden or 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
<? | |
session_start(); | |
define('HPSURL',"https://psp.transactium.com/hpservices/ws/hpws.v1100.asmx"); | |
include('utils.php'); | |
/* AMEND FOLLOWING SECTION WITH PAYMENT DETAILS */ | |
$hp=new CTransactiumHPP("--USERNAME--","--PASSWORD--"); | |
$params=array( | |
'Amount'=>0, ///payment amount | |
'Curr'=>"EUR"; ///payment currency |