Skip to content

Instantly share code, notes, and snippets.

View DamonOehlman's full-sized avatar

Damon Oehlman DamonOehlman

View GitHub Profile
@tmpvar
tmpvar / offset-minkowski-surface-nets.js
Last active August 29, 2015 14:02
offsetting adventures (run these with beefy!)
var Polygon = require('polygon');
var fc = require('fc');
var Vec2 = require('vec2');
var ndarray = require('ndarray');
var sn = require('surface-nets');
var cwise = require('cwise');
var fill = require('ndarray-fill');
var poly = new Polygon([
@morganherlocker
morganherlocker / voxel-openstreetmap.md
Last active August 29, 2015 14:05
voxel osm vector tile algo

This is a rough spec for an implementation of a realtime virtual world using OpenStreetMap data and voxel.js. The basic idea is to encode feature data pulled from Mapbox vector tiles as overzoomed tiles, which can be represented as voxels. This allows for easy scalability, since it utilizes existing algorithms and architecture.

The initial implementation is going on here.

###general

  • 1 voxel = 1 tile at zoom 17 = 1.1943 sq meters
  • the world is a 33,554,432 x 33,554,432 voxel grid
  • assume that a server is serving up vector tile pbfs at z15 (mapbox.com, local, etc.)
  • vector tiles are loaded at zoom 15 and geometry is encoded as 4096x4096 pixel coordinates, which is equivalent to tiles at zoom 24
@mobz
mobz / DOMj.mdown
Created May 28, 2012 05:53
DOM transport via JSON (DOMj)

DOM transport via JSON (DOMj)

move to repo mobz/domj

@max-mapper
max-mapper / index.js
Created July 7, 2012 00:04
geohash based spatial index on leveldb
var plumbdb = require('plumbdb')
var shp2json = require('shp2json')
var tako = require('tako')
var geohash = require('geohash').GeoHash
var JSONStream = require('JSONStream')
var async = require('async')
var gju = require('geostuff')
var t = tako()

Assume concat is some function sticking two strings together, and uppercase is... well:

Haskell (argument application):

> let a |> f = f a

> "def"
    |> (\x -> concat "abc" x)
 |> uppercase -- (\x -> uppercase x) if you want to be explicit.
@sterlingwes
sterlingwes / webplatform.js
Created March 6, 2013 05:30
BlackBerry WebWorks Native Javascript Wrapper exposed at platform:///webplatform.js by webviews
(function () {
/*
Copyright 2012 Research In Motion Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@legastero
legastero / gist:7127532
Last active December 26, 2015 09:09
Where to find XMPP/Jingle in JS resources
@max-mapper
max-mapper / index.js
Created August 11, 2012 00:14
geo queries on leveldb (geohash) (not really usable)
var plumbdb = require('plumbdb')
var shp2json = require('shp2json')
var tako = require('tako')
var geohash = require('geohash').GeoHash // my fork (not on npm): https://github.com/maxogden/geohash-js
var JSONStream = require('JSONStream')
var async = require('async')
var gju = require('geostuff')
var t = tako()
@valueof
valueof / user.behaviors.clj
Last active January 4, 2016 18:49
LightTable Configuration
;; https://gist.github.com/antonkovalyov/8663025
{:+ {
;; The app tag is kind of like global scope. You assign behaviors that affect
;; all of Light Table here
:app [(:lt.objs.style/set-skin "light")]
;; The editor tag is applied to all editors
:editor [:lt.objs.editor/no-wrap
(:lt.objs.style/set-theme "solarized-light")
@max-mapper
max-mapper / readme.md
Created September 28, 2011 02:01
SLEEP - syncable.org

Your API does REST, but can it SLEEP?

SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.


SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.

If you synchronize data from a remote source and then the