Skip to content

Instantly share code, notes, and snippets.

View bradbatt's full-sized avatar

Brad Batt bradbatt

View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@sajal
sajal / dns_update.py
Created January 6, 2012 20:16
DYI dynamic DNS using python/boto
from boto.route53.connection import Route53Connection
import urllib2
from syslog import syslog
# ======= CONFIG ========
AWS_ACCESS_KEY_ID = 'XXXXXXXXXXXXXXXXXX'
AWS_SECRET_ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
DDNSNAME = "foo.example.com." # Should end in period
ZONEID = "XXXXXXXXX"
# ===== END CONFIG ======
@ttscoff
ttscoff / dotjssafarifix
Created October 17, 2011 14:07
Add CSS loading to dot.js Safari extension
# Adding CSS loading to dot.js Safari Extension
#################################
# /usr/local/bin/djsd line 33-42
# just need to add "css" to the detect origin function
def detect_origin(req)
path = req.path
origin = req.header['origin']
search = path.gsub('/','').gsub(/\.(js|css)$/,'') + '$'
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh