Skip to content

Instantly share code, notes, and snippets.

View wboykinm's full-sized avatar

Bill Morris wboykinm

View GitHub Profile
@wboykinm
wboykinm / turf_and_vts.md
Last active April 15, 2024 14:57
Learnings while geoprocessing vector tiles with turf.js
@wboykinm
wboykinm / histogram.sql
Created October 12, 2015 13:07 — forked from wolever/histogram.sql
Functions to create and draw histograms with PostgreSQL.
-- Functions to create and draw histograms with PostgreSQL.
-- psql> select * from show_histogram((select histogram(length(email), 0, 32, 6) FROM auth_user limit 100));
-- bucket | range | count | bar | cumbar | cumsum | cumpct
-- --------+-------------------------------------+-------+--------------------------------+--------------------------------+--------+------------------------
-- 0 | [0,5.33333333333333) | 1 | | | 1 | 0.00273224043715846995
-- 1 | [5.33333333333333,10.6666666666667) | 5 | = | | 6 | 0.01639344262295081967
-- 2 | [10.6666666666667,16) | 149 | ============================== | ============= | 155 | 0.42349726775956284153
-- 3 | [16,21.3333333333333) | 145 | =========
@wboykinm
wboykinm / falsehoods.md
Last active February 1, 2024 15:52
Falsehoods programmers believe about addresses - by Michael Tandy

Falsehoods programmers believe about addresses

This is an anchor-linked version of the excellent, amazing original opus magnum by Michael Tandy.

An address will start with, or at least include, a building number.

Counterexample: Royal Opera House, Covent Garden, London, WC2E 9DD, United Kingdom.

When there is a building number, it will be all-numeric.

Counterexample: 1A Egmont Road, Middlesbrough, TS4 2HT

@wboykinm
wboykinm / geojson.php
Last active January 19, 2024 21:09
Sample PHP to Point GeoJSON
<?php
/**
* PHP GeoJSON Constructor, adpated from https://github.com/bmcbride/PHP-Database-GeoJSON
*/
# Connect to MySQL database
$conn = new PDO('mysql:host=localhost;dbname=mydatabase','myusername','mypassword');
# However the User's Query will be passed to the DB:
$sql = 'SELECT * from GDA_database WHERE user_query = whatever';
@wboykinm
wboykinm / confidence.js
Last active November 13, 2023 06:43
Sample Size Calculator
// Adapted from CRS: http://www.surveysystem.com/sscalc.htm
conInt = 0;
conLev=1;
zVal=1.96;
zValC=3.8416;
ss=0;
pop=0;
perc=0;
pf = 0;

How to deploy a webpage in 2022

Instructions for getting a [mostly] static website onto a custom domain, with https encryption, for [mostly] free. I'm finally writing this down after getting stuck on step 10 way too many times. Godspeed.

  1. Purchase the top-level domain - gandi.net is my current preferred registrar. Hopefully this will be the only cash you drop in this process.
  2. Create a new public repository on github.
  3. Clone the new repo locally and create your site content package, even starting with something as simple as a standalone index.html.
  4. Add a file called CNAME to the repo, containing only a single line with your just-purchased domain in it. e.g. domain.com.
  5. Commit the content to github.
  6. In the settings --> pages menu of the repository on github.com, point to the correct branch, and enter the domain under "Cu
@wboykinm
wboykinm / index.html
Created November 10, 2013 04:09
Leaflet + D3 + Vector Tiles (via Nelson Minar)
<!DOCTYPE html>
<meta charset="utf-8">
<title>D3 GeoJSON in Leaflet</title>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'>
<![endif]--><style>
html, body, #map { height: 100%;width:100%; background:#020B26;position:absolute;}
body { padding: 0; margin: 0; }
path { stroke-linejoin; round; stroke-linecap: round; fill: none}
@wboykinm
wboykinm / index.html
Created December 17, 2012 20:54
Mapbox.js Layers + Bootstrap.js
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<script src='http://geosprocket.com/assets/bootstrap/js/bootstrap.min.js'></script>
<link href='http://geosprocket.com/assets/bootstrap/css/bootstrap-spruce.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
@wboykinm
wboykinm / README.md
Last active January 17, 2023 17:56
New Mapbox UI Styles
@wboykinm
wboykinm / compton.md
Last active December 16, 2022 21:15