Skip to content

Instantly share code, notes, and snippets.

@kdonaldson
kdonaldson / django-crossdomainxhr-middleware.py
Created September 8, 2012 17:16 — forked from jessykate/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
'''
EXAMPLE USAGE:
Put this file in a directory called, eg, 'middleware,' inside your django
@kdonaldson
kdonaldson / django-crossdomainxhr-middleware.py
Created September 8, 2012 17:18 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@kdonaldson
kdonaldson / audio.html
Created September 24, 2012 07:19 — forked from macdonst/audio.html
PhoneGap Media Class Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PhoneGap Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.5.js"></script>
<script type="text/javascript" charset="utf-8">
var myMedia = null;
@kdonaldson
kdonaldson / gist:5245571
Created March 26, 2013 13:58
Regex-based tokenizer keeping delimiters
import re
re.compile(r'(\s+)').split(<some string>)
@kdonaldson
kdonaldson / automatic_date_fields
Last active December 17, 2015 02:39
Automatic creation date for django models
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
/usr/bin/curl -fLA Homebrew 0.9.5 (Ruby 1.8.7-358; Mac OS X 10.9.2) ftp://ftp.stunnel.org/stunnel/archive/4.x/stunnel-4.56.tar.gz -C 0 -o /Library/Caches/Homebrew/stunnel-4.56.tar.gz.incomplete --connect-timeout 5
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (67) Access denied: 500
Trying a mirror...
==> Downloading http://ftp.nluug.nl/pub/networking/stunnel/stunnel-4.56.tar.gz
/usr/bin/curl -fLA Homebrew 0.9.5 (Ruby 1.8.7-358; Mac OS X 10.9.2) http://ftp.nluug.nl/pub/networking/stunnel/stunnel-4.56.tar.gz -C 0 -o /Library/Caches/Homebrew/stunnel-4.56.tar.gz.incomplete
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
@kdonaldson
kdonaldson / tokbox.html
Last active August 29, 2015 14:06 — forked from andrew/tokbox.html
<!DOCTYPE html>
<html>
<head>
<title>OpenTok API Sample &#8212; Stand-Alone Archives</title>
<link href="/css/demos.css" type="text/css" rel="stylesheet" >
<script src="http://static.opentok.com/v1.1/js/TB.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var recorderManager;
var recorder;
var player;
@kdonaldson
kdonaldson / gist:89a75db359ef7ed06657
Last active September 4, 2015 02:26
heroku phoenix log
2015-09-04T01:47:56.148268+00:00 heroku[slug-compiler]: Slug compilation started
2015-09-04T01:47:56.148308+00:00 heroku[slug-compiler]: Slug compilation finished
2015-09-04T01:47:56.207416+00:00 heroku[web.1]: State changed from crashed to starting
2015-09-04T01:48:03.439837+00:00 heroku[web.1]: Starting process with command `mix phoenix.server`
2015-09-04T01:49:03.470058+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-09-04T01:49:03.470058+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-09-04T01:49:04.369722+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-04T01:49:04.371226+00:00 heroku[web.1]: State changed from crashed to starting
2015-09-04T01:49:04.349436+00:00 heroku[web.1]: Process exited with status 137
2015-09-04T01:49:11.828837+00:00 heroku[web.1]: Starting process with command `mix phoenix.server`