Skip to content

Instantly share code, notes, and snippets.

curl --data '{"type":"Point","coordinates":[1,2]}' http://geojsonlint.com/validate
@JasonSanford
JasonSanford / gist:3419822
Created August 21, 2012 21:59
Tips/Tricks for searching for a bike on Craigslist
Bike Types
Mountain, Road, BMX, Frame
Pictures
Yes, No
No Wal-mart bikes
-next -mongoose -huffy -roadmaster -schwinn -landrider -magna -disney
No women's bikes
import scraperwiki
import lxml.html
html = scraperwiki.scrape("http://www.greatamericanbeerfestival.com/at-the-festival/breweries-at-the-2012-festival")
root = lxml.html.fromstring(html)
i = 1
for tr in root.cssselect("#brewery_table tbody tr"):
tds = tr.cssselect("td")
data = {
(function() {
var qs = function () {
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
@JasonSanford
JasonSanford / geojson.js
Created July 6, 2012 22:24 — forked from mourner/geojson.js
Leaflet GeoJSON API proposal
var geojson = L.geoJson(data, {
// style for all vector layers (color, opacity, etc.) (optional)
getStyle: function (feature) {
return feature.properties && feature.properties.style;
},
// function for creating layers for GeoJSON point features (optional)
pointToLayer: function (feature, latlng) {
return L.marker(latlng, {
// parseInt usually works just fine
parseInt("8") // outputs 8
// until you are padded left with zeros
parseInt("08") // outputs 0
// easy to fix with radix parameter
parseInt("08", 10) // outputs 8
{
"currentVersion": 10.01,
"id": 1,
"name": "Intersections",
"type": "Feature Layer",
"description": "",
"definitionExpression": "",
"geometryType": "esriGeometryPoint",
"copyrightText": "",
"parentLayer": null,
@JasonSanford
JasonSanford / sqlalchemygeom.py
Created November 10, 2011 06:05
Modifications to MapFish's sqlalchemygeom.py for vector simplification
#
# Copyright (C) 2009 Camptocamp
#
# This file is part of MapFish Server
#
# MapFish Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@JasonSanford
JasonSanford / protocol.py
Created November 10, 2011 05:53
MapFish protocol modifications for vector simplification
#
# Copyright (C) 2009 Camptocamp
#
# This file is part of MapFish Server
#
# MapFish Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@geojsonify
def geojson(self, z=False, x=False, y=False):
"""GET /{z}/{x}/{y} return features within tile bounds."""
return self.protocol.geojson(request, response, z=z, x=x, y=y)