Skip to content

Instantly share code, notes, and snippets.

View wboykinm's full-sized avatar

Bill Morris wboykinm

View GitHub Profile
@wboykinm
wboykinm / index.html
Last active December 16, 2015 09:38 — forked from andrewxhill/index.html
CartoDB Typeahead
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Typeahead + CartoDB</title>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="well">
<input type="text" class="span6" id="filter" data-provide="typeahead" data-items="6" />
@wboykinm
wboykinm / index.html
Last active December 16, 2015 17:10 — forked from bsudekum/index.html
mapbox.js vectors via @BobWs
<!--Example for: http://mapbox.com//blog/vector-tile-sandwich/-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html>
<head>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' />
@wboykinm
wboykinm / size_order.sql
Last active December 17, 2015 02:08 — forked from andrewxhill/size_order.sql
Adapting Andrew's polygon-arranger
WITH RECURSIVE dims AS (SELECT 2*sqrt(sum(ST_Area(the_geom))) as d, sqrt(sum(ST_Area(the_geom)))/20 as w, count(*) as rows FROM territory_all_copy WHERE the_geom IS NOT NULL),
geoms AS (SELECT the_geom, ST_YMax(the_geom)-ST_YMin(the_geom) as height FROM territory_all_copy WHERE the_geom IS NOT NULL ORDER BY ST_YMax(the_geom)-ST_YMin(the_geom) DESC),
geomval AS (SELECT the_geom, row_number() OVER (ORDER BY height DESC) as id from geoms),
positions(the_geom,x_offset,y_offset,new_row,row_offset) AS (
(SELECT the_geom, 0.0::float, 0.0::float, FALSE, 2 from geomval limit 1)
UNION ALL
(
SELECT
(SELECT the_geom FROM geomval WHERE id = p.row_offset),
CASE WHEN
@wboykinm
wboykinm / README.md
Last active December 20, 2015 02:49 — forked from benbalter/README.md
Github as a geodata server, take 4: Success with the CRUD API

Thanks to Ben Balter For - in this case - showing how the Github CRUD API can be used to tap hosted topojson (or geojson) for cross-domain apps like this D3 implementation.

@wboykinm
wboykinm / README.md
Last active December 21, 2015 03:18 — forked from dwtkns/README.md
@wboykinm
wboykinm / README.md
Last active December 21, 2015 05:39 — forked from mbostock/.block
Mike's recipe for dynamic feature simplification

A combination of the map zooming and dynamic simplification demonstrations: as the map zooms in and out, the simplification area threshold is adjusted so that it is always appropriate to the current scale. Thus, the map looks good and renders quickly at all points during the animation.

An additional rendering optimization is that points outside the current viewport are much more heavily simplified than points inside the viewport. This is, in effect, a cheap approximation of viewport clipping.

@wboykinm
wboykinm / proxy.php
Created September 18, 2013 20:01 — forked from bmcbride/proxy.php
<?php
$ch = curl_init($_GET['url']);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
@wboykinm
wboykinm / README.md
Last active December 25, 2015 09:39 — forked from mbostock/.block
linked mouseover starting point

THIS IS THE WORK OF MIKE BOSTOCK! IN ITS ENTIRETY! I'M JUST FIDDLING WITH THE STYLES!

This is a simple example of using CSS class names to support cross-linking between tree elements. Each element in the tree has an associated type field in the data, indicating whether the species is wild or domesticated. (This is bogus data, of course, and only for demonstration purposes.) When you mouseover one of the leaf nodes, other nodes of the same type will highlight.

The coordination happens in two places. First, the G elements for the nodes have a computed class attribute:

.attr("class", function(d) { return "node " + d.type; })

Next, register a mouseover and mouseout handler for interaction:

@wboykinm
wboykinm / README.md
Last active December 25, 2015 15:49 — forked from mbostock/.block