Skip to content

Instantly share code, notes, and snippets.

@yhahn
yhahn / 10.196.370.png
Last active August 29, 2015 14:05
solid vt testcase
10.196.370.png
@yhahn
yhahn / ami.js
Last active August 29, 2015 14:06
Get latest trusty AMIs
var https = require('https');
var body = '';
https.get('https://cloud-images.ubuntu.com/locator/ec2/releasesTable', function(res) {
res.on('data', function(chunk) { body += chunk; });
res.on('end', finish);
});
function finish() {
// Bad JSON -- has trailing comma.
@yhahn
yhahn / marker.png
Last active August 29, 2015 14:07
mapnik markersnapping testcase
marker.png
@yhahn
yhahn / index.js
Last active August 29, 2015 14:26
fnv-plus collision tests
var fnvplus = require('fnv-plus');
function collisionRate(bits) {
var hashes = {};
var texts = 0;
var collisions = [];
var sample = 1e6;
while (texts < sample) {
var text = Math.random().toString(36);
var hash = fnvplus.hash(text,bits).hex();
@yhahn
yhahn / index.js
Created July 31, 2015 17:16
murmur collision tests
var fnvplus = require('fnv-plus');
var murmur = require('murmur');
function collisionRate(bits) {
var hashes = {};
var texts = 0;
var collisions = [];
var sample = 1e6;
console.time(bits + ' bits');
while (texts < sample) {
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