Skip to content

Instantly share code, notes, and snippets.

View tristen's full-sized avatar

Tristen Brown tristen

View GitHub Profile
!function t(e,r,n){function i(u,s){if(!r[u]){if(!e[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var c=r[u]={exports:{}};e[u][0].call(c.exports,function(t){var r=e[u][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[u].exports}for(var o="function"==typeof require&&require,u=0;u<n.length;u++)i(n[u]);return i}({1:[function(t,e,r){"use strict";function n(t){_=_.slice(0,l+1);var e=t(_[l]);_.push(e),l++,o()}function i(){c.addSource("geojson",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),c.addLayer({id:"polygon-query-fill",type:"fill",source:"geojson",paint:{"fill-color":"#027dbd","fill-opacity":.1}}),c.addLayer({id:"polygon-query-line",type:"line",source:"geojson",paint:{"line-color":"#027dbd","line-width":3}});var t=c.getCanvas().offsetWidth,e=c.getCanvas().offsetHeight,r=document.getElementById("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var n=new a(r)
@tristen
tristen / index.html
Created January 22, 2016 15:35
mapbox-gl-js v0.12.3 rendering bug
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.3/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.3/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@tristen
tristen / index.html
Created January 20, 2016 23:57
un-performant layer switching
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<link href='https://www.mapbox.com/base/latest/base.css' rel='stylesheet' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.1/mapbox-gl.css' rel='stylesheet' />
<style>
@tristen
tristen / index.html
Created January 14, 2016 16:03
Centered geocoder control
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.2/mapbox-gl.js'></script>
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v0.0.0/mapbox-gl-geocoder.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v0.0.0/mapbox-gl-geocoder.css' type='text/css' />
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.2/mapbox-gl.css' rel='stylesheet' />
@tristen
tristen / index.js
Created November 20, 2015 22:10
Using tablesort.extend in browserified tablesort
'use strict';
var tablesort = require('tablesort');
function cleanNumber(i) {
return i.replace(/[^\-?0-9.]/g, '');
}
function compareNumber(a, b) {
a = parseFloat(a);
@tristen
tristen / index.html
Last active August 28, 2015 01:31
movie loopin
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.video-wrapper {
position:relative;
width:640px;
height:360px;
}
@tristen
tristen / example.js
Last active August 29, 2015 14:24
layer group from array
var layers = [
{
label: 'foo',
url: 'foo'
},
{
label: 'bar',
url: 'bar'
}
].reduce(function(memo, layer) {
@tristen
tristen / index.html
Created February 5, 2015 20:49
fixed header + full screen map
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A simple map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@tristen
tristen / index.html
Created November 17, 2014 17:15
Filter markers from HTML generated markers
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Filter markers from HTML generated markers</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@tristen
tristen / index.html
Last active August 29, 2015 14:08
Build markers from HTML
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Build markers from HTML</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }