Skip to content

Instantly share code, notes, and snippets.

@aymanfarhat
aymanfarhat / urlobject.js
Last active July 27, 2017 00:04
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@supr
supr / gist:1166302
Created August 23, 2011 19:50
For golang http.Handler to serve static files on /foo mounted at /xyz/foo
package main
import (
"http"
)
func main() {
http.Handle("/foo/", http.StripPrefix("/foo", http.FileServer(http.Dir("/xyz/foo/"))))
http.ListenAndServe(":6543", nil)
}
@paulcuth
paulcuth / tfl-tube-data.json
Created July 28, 2011 09:47
TfL tube line & station data in JSON format.
var lines = {
B: 'Bakerloo',
C: 'Central',
D: 'District',
H: 'Hammersmith & Circle',
J: 'Jubilee',
M: 'Metropolitan',
N: 'Northern',
P: 'Piccadilly',