Skip to content

Instantly share code, notes, and snippets.

var usedCoordinates = [ { x: 10, y: 5 }, { x: 10, y: 6 }, { x: 10, y: 7 } ];
var coordinates = [ { x: 10, y: 7 }, { x: 10, y: 8 } ];
// Should be [ { x: 10, y: 7 } ]
var intersection = _.select(coordinates, function(element){
return _.any(usedCoordinates, function(otherElement){
return _.isEqual(element, otherElement);
});
});
@yhahn
yhahn / gist:995372
Created May 27, 2011 14:39
tilemill bones templates : |
devseed@devseed:~/tilemill/templates$ ls
App._ ExportOptions._ Project._
Asset._ ExportRow._ ProjectFormatForm._
Assets._ Exports._ ProjectInteractivityForm._
ColorSwatch._ FileLayerForm._ ProjectLegendForm._
ColorSwatches._ FontPicker._ ProjectPopupInteractivity._
Datasource._ Layer._ Projects._
DatasourceRows._ Layers._ ProjectSettingsForm._
DatasourceTooltip._ Libraries._ Reference._
Drawer._ LibrariesPopup._ ReferenceProperty._
@yhahn
yhahn / api.md
Created September 30, 2011 15:39
API sketch

Root

api.tiles.mapbox.com/v1/

Albums

api.tiles.mapbox.com/v1/albums.json
api.tiles.mapbox.com/v1/albums.jsonp
set ROOT=c:\Program Files (x86)\TileMill
set PROJ_LIB=%ROOT%\data\proj\nad
set GDAL_DATA=%ROOT%\data\gdal\data
set PATH=%PATH%;%ROOT%\node_modules\zipfile\lib
set PATH=%PATH%;%ROOT%\node_modules\mapnik\lib\mapnik\lib
node index.js
@yhahn
yhahn / report.md
Created February 1, 2012 21:48
export report
  • world coastline as line
  • zoom 0 - 8
  • Copied is total z,x,y coordinates considered.
  • Blank is total number of tiles considered fully transparent.
  • Skipped is total z,x,y coordinates that are never requested from Mapnik at all.

Results

--metatile=8
use_spatial_index=false
> var und = require('underscore');
> console.warn(und(['foobar']).min(function(o) { return Infinity }));
undefined
> console.warn(und(['foobar']).min(function(o) { return 1e20 }));
foobar
@yhahn
yhahn / retirement.md
Created June 1, 2012 16:15
retirement

If I retire

  • Go from tadpole => frog using only css animation
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.5/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.5/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Example</title>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.3/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }