Skip to content

Instantly share code, notes, and snippets.

View longhotsummer's full-sized avatar

Greg Kempe longhotsummer

View GitHub Profile
@longhotsummer
longhotsummer / centroid.js
Last active July 7, 2016 06:56
Using D3, topojson and node.js to calculate the centroid of topojson features
/* A node.js script that uses D3 and topojson to calculate and output the lat/long
* coordinates of the centroid for a collection of topojson boundary features.
*/
// install using npm install d3
var d3 = require("d3");
// download from http://d3js.org/topojson.v1.min.js
var topojson = require("./topojson.v1.min.js");
// load json
// Using leaflet.js to pan and zoom a big image.
// See also: http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
// create the slippy map
var map = L.map('image-map', {
minZoom: 1,
maxZoom: 4,
center: [0, 0],
zoom: 1,
crs: L.CRS.Simple
@longhotsummer
longhotsummer / counties.topojson
Last active August 29, 2015 14:04
Kenya counties
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@longhotsummer
longhotsummer / bkcpt.json
Last active August 29, 2015 14:05
CPT cycle paths (very basic)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@longhotsummer
longhotsummer / bkcpt-wifi.json
Created August 30, 2014 21:46
Free Wifi hotspots in Cape Town (from http://www.findfreewifi.co.za/)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@longhotsummer
longhotsummer / cpt-boundary.geojson
Created September 5, 2014 09:07
Cape Town Municipality boundary
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@longhotsummer
longhotsummer / metered-taxi.xml
Created November 20, 2014 21:07
Metered Taxi by-law XML
<?xml version="1.0" encoding="UTF-8"?>
<akomaNtoso xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.akomantoso.org/2.0" xsi:schemaLocation="http://www.akomantoso.org/2.0 akomantoso20.xsd">
<act contains="originalVersion">
<meta>
<identification source="#openbylaws">
<FRBRWork>
<FRBRthis value="/za/by-law/locale/1980/name/main"/>
<FRBRuri value="/za/by-law/locale/1980/name"/>
<FRBRalias value="By-Law Short Title"/>
<FRBRdate date="1980-01-01" name="Generation"/>
@longhotsummer
longhotsummer / metered-taxi.txt
Created November 20, 2014 21:08
Metered Taxi by-law text
CITY OF JOHANNESBURG METROPOLITAN MUNICIPALITY
METERED TAXI, MINIBUS, MIDIBUS AND BUS BY-LAWS
The Municipal Manager of the City of Johannesburg Metropolitan Municipality hereby, in terms of Section 13(a) of the Local Government: Municipal Systems Act, 2000 (Act No 32 of 2000), publishes the Metered Taxi, Minibus, Midibus and Bus By-laws for the City of Johannesburg Metropolitan Municipality, as approved by its Council and as concurred with by the Premier: Gauteng Province in terms of section 80A of the National Road Traffic Act, 1996 (Act 89 of 1996), as set out hereunder.
CITY OF JOHANNESBURG METROPOLITAN MUNICIPALITY
METERED TAXI, MINIBUS, MIDIBUS AND BUS BY-LAWS
CHAPTER 1
INTERPRETATION
Definitions
1. (1) In these By-laws, any word or expression that has been defined in the Gauteng Public Passenger Road Transport Act, 2001 (Act No. 7 of 2001) has that meaning and, unless the context otherwise indicates –
“authorised official” means any official of the Council who has been authorised by it to administer, im
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv env", so your project folder
# has a env folder at the top level, next to your version control directory.
@longhotsummer
longhotsummer / leaflet-big-image-full.html
Created April 5, 2016 06:47
Full example of using leaflet to pan and zoom a big image, as described at http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
<html>
<!-- See also: http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html -->
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"></script>
<style>
#image-map {
width: 100%;
height: 300px;
border: 1px solid #ccc;
margin-bottom: 10px;