Skip to content

Instantly share code, notes, and snippets.

// Add G, [minx, miny, maxx, maxy] as a bbox option to polymaps, after line 212:
case "G": {
var nw = po.map.coordinateLocation({row: c.row, column: column, zoom: c.zoom}),
se = po.map.coordinateLocation({row: c.row + 1, column: column + 1, zoom: c.zoom}),
pn = Math.ceil(Math.log(c.zoom) / Math.LN2);
return nw.lon.toFixed(pn)
+ "," + se.lat.toFixed(pn)
+ "," + se.lon.toFixed(pn)
+ "," + nw.lat.toFixed(pn);
}
@bmount
bmount / wp_bulk_upload_photo_directories_via_rss.py
Created December 21, 2011 11:05
Bulk upload directory tree photo galleries to wordpress via RSS
# a jinja2 xml template compatible with Wordpress RSS
# import. Based on Flickr GeoRSS format.
# wp rss import v 0.2 did not like couple of other
# variations on this.
# takes dictionary like {"directory/subdir":[list, of, filenames],
# "dir2/subdir":[other, file, names]}
<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
@bmount
bmount / polymaps-bvmou-nonwrapping-tms-template.js
Created December 26, 2011 22:34
couple of polymaps tweaks for tms 1.0 (template H line ~205) and couchdb bbox (case "G" same vicinity)
if (!org) var org = {};
if (!org.polymaps) org.polymaps = {};
(function(po){
po.version = "2.5.1"; // semver.org
var zero = {x: 0, y: 0};
po.ns = {
svg: "http://www.w3.org/2000/svg",
xlink: "http://www.w3.org/1999/xlink"
@bmount
bmount / kmz2json-index.js
Created January 26, 2012 03:09
Node.js kmz-to-json stream via ogr2ogr. from substack/shp2json
var spawn = require('child_process').spawn;
var fs = require('fs');
var path = require('path');
var seq = require('seq');
var findit = require('findit');
var BufferedStream = require('morestreams').BufferedStream;
module.exports = function (inStream) {
var id = Math.floor(Math.random() * (1<<30)).toString(16);
var tmpDir = path.join('/tmp', id);
@bmount
bmount / conway.c
Created June 15, 2012 00:48
game of life
#include <stdio.h>
#include <stdlib.h>
#define X 121
#define Y 51
// Conway's Game of Life
// make conway && ./conway
// change X and Y for display area
@bmount
bmount / postgres_plist.xml
Created June 15, 2012 00:49
postgres plist a la homebrew
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.pg92beta.plist</string>
<key>ProgramArguments</key>
<array>
@bmount
bmount / datafirst.md
Created October 17, 2012 00:05
Data before APIs before Applications

This is a little feedback for people implementing open government (geo-) data projects — the good guys, like Bronwyn Agrios and Jay Nath. I had a little interaction today with some of you, related to a pedestrian safety dataset and interactive map:

@jay_nath @ajturner @bronwynagrios @shannonspanhake It takes more time for a programmer to figure out that API than to make a better map...

— Brian Mount (@brian_mount) October 15, 2012
@bmount
bmount / designcodes.md
Created October 20, 2012 10:14
differences between different kinds of design codes

1911 tenement

"The discoveries of the last few years have radically altered our methods of treatment of sewage, both within and without the building. We have through these discoveries, learned why it is that sewage must be quickly removed from our neighborhood instead of being allowed to remain in cesspools... The science of bacteriology has become to the sanitary engineer, in a certain sense, the most

@bmount
bmount / sfbuildratio.md
Created November 5, 2012 21:25
San Francisco building footprint ratio

Quick look at proportion of land within SF that is covered by a structure according to city building footprint data. This excludes interior courtyards, uncovered ground-level parking, ie everything without a roof.

Area measurements in square meters, excluding the bay and lakes (census tracts may include bodies of water, this compares only land area.)

Zoom in to see the census tract outline. Also, some of the numbered links are bad, if so try the 'unbroken link'.

@bmount
bmount / trb_feedback.md
Created November 22, 2012 13:27
TRB Feedback

The Assembly and Interpretation of Transit Data

A freeway, Tilton warned, "is a device which can make or break the city. It can liberate or contribute to congestion. It can cut the city into unrelated parts, or bind it together. It can destroy values, or create new ones. The State cannot soundly develop its urban freeway plans without attention to the planning problems of the city itself." Tilton criticized the state for a narrow approach that considered merely "the assembly and interpretation of traffic data...