Skip to content

Instantly share code, notes, and snippets.

View arshaver's full-sized avatar

Anthony Shaver arshaver

View GitHub Profile
// ==UserScript==
// @name Splitwise keybindings
// @version 0.1
// @description adds two keybindings to splitwise
// @match https://secure.splitwise.com
// @require http://cdn.craig.is/js/mousetrap/mousetrap.min.js
// @downloadURL https://gist.githubusercontent.com/arshaver/9999759/raw/
// ==/UserScript==
Mousetrap.bind('b', function(e, combo) {
@arshaver
arshaver / own3d.xml
Created January 16, 2012 03:50
own3d
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Own3d</author>
<description>Own3d's API</description>
<documentationURL>none</documentationURL>
<sampleQuery>select * from {table} where limit = "20"</sampleQuery>
</meta>
<bindings>
<select itemPath="rss.channel.item" produces="XML">
@arshaver
arshaver / jtv.xml
Created January 16, 2012 02:57
jtv
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Justin.tv</author>
<description>Justin.tv's API</description>
<documentationURL>none</documentationURL>
<sampleQuery>select * from {table} where category = "gaming" and limit = "20"</sampleQuery>
</meta>
<bindings>
<select itemPath="streams" produces="XML">
@arshaver
arshaver / jsonp_decorator.py
Created January 9, 2012 00:28 — forked from sivy/jsonp_decorator.py
a jsonp view decorator for Django
def jsonp(f):
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters
are provided, will wrap the json output in callback({thejson})
Usage:
@jsonp
def my_json_view(request):
d = { 'key': 'value' }
@arshaver
arshaver / JsonpResponse.py
Created January 6, 2012 00:24
Django JsonpResponse
#adapted from http://nigel.jp/2011/06/jsonp-with-django/
#JsonpResponse object
import json
from django.http import HttpResponse
class JsonpResponse(HttpResponse):
def __init__(self, data, callback):
json = json.dumps(data)
jsonp = "%s(%s)" % (callback, json)
HttpResponse.__init__(
<document>
<location>
<name>Paris</name>
<latitude>48.856667</latitude>
<longitude>2.350987</longitude>
<type>an</type>
<target></target>
<imageurl></imageurl>
<description>France</description>
</location>