Skip to content

Instantly share code, notes, and snippets.

View elijahzarlin's full-sized avatar

Elijah Zarlin elijahzarlin

View GitHub Profile
@elijahzarlin
elijahzarlin / pulumixmapbox2.js
Last active June 13, 2019 16:37
pulumixmapbox2.js
```ts
"use strict";
const pulumi = require("@pulumi/pulumi");
const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");
//* Create Kinesis stream for ingestion
const ingestStream = new aws.kinesis.Stream("ingestAssets", {
shardCount: 1,
retentionPeriod: 72
@elijahzarlin
elijahzarlin / pulumixmapbox1.js
Last active June 13, 2019 16:34
pulumixmapbox1
```bash
$ brew install pulumi
$ mkdir asset-tracking && cd asset-tracking
$ pulumi new aws-javascript
$ yarn install
$ ls
Pulumi.dev.yaml Pulumi.yaml index.js node_modules package-lock.json package.json
```
<html>
<head>
<title>Deckgl RGB PointCloud + Mapbox</title>
<script src="https://unpkg.com/deck.gl@^7.0.0/dist.min.js"></script>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.js"></script>
<link rel="stylesheet" type="text/css" href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.css">
<style>
body {
background-color: #000000;
margin: 0;
@elijahzarlin
elijahzarlin / hurricane-map-4.js
Last active October 23, 2018 19:32
hurricane-map-4
[
"interpolate",
["linear"],
["zoom"],
2,
[
"/",
[
"max",
[
@elijahzarlin
elijahzarlin / hurricane-map-3.js
Last active October 23, 2018 19:31
hurricane-map-3
[
"interpolate",
["linear"],
["get", "WindSpeed.Kph"],
55,
"hsl(47, 100%, 90%)",
120,
"hsl(340, 100%, 82%)",
220,
"#ff0040"
@elijahzarlin
elijahzarlin / hurricane-map-2.js
Created October 23, 2018 18:48
hurricane-map-2
let bearing = ruler.bearing(firstPoint, nextPoint);
let p1 = ruler.destination(nextPoint, errorRadius, bearing + 90);
let p2 = ruler.destination(firstPoint, acc.prevPoint.errorRadius, bearing + 90);
let p3 = ruler.destination(firstPoint, acc.prevPoint.errorRadius, bearing - 90);
let p4 = ruler.destination(nextPoint, errorRadius, bearing - 90);
const polygon = turf.polygon([[p1, p2, p3, p4, p1]]);
@elijahzarlin
elijahzarlin / hurricane-map-1.js
Last active October 23, 2018 18:50
hurricane-map-1
const errorRadiusKm = ruler.distance([item.lon, item.lat], [item.lon + errorRadiusDeg, item.lat]);
const circle = turf.circle([item.lon, item.lat], errorRadiusKm, {steps: 32, units: 'kilometers'});
@elijahzarlin
elijahzarlin / arc-layer-deck-gl.js
Last active October 12, 2018 19:35
arc layer deck gl
const map = new mapboxgl.Map({
container: "map",
style: "mapbox://styles/mapbox/light-v9",
center: [-122.398, 37.788],
zoom: 12,
pitch: 60
});
map.on("style.load", () => {
// Get data for the arc map from SFMTA origin/destination routes
@elijahzarlin
elijahzarlin / emerald-star-2.js
Created September 14, 2018 18:42
rock n roll turn
var nearest = turf.nearestPoint(user, locations);
var bearing = turf.bearingToAzimuth(turf.bearing(user, nearest));
var distance = turf.distance(user, nearest, { units: meters });
if (distance < 50) {
// Unlock Emerald Star
}
@elijahzarlin
elijahzarlin / emerald-star-1.js
Last active September 14, 2018 18:40
rock n' roll cartographer
var locations = turf.featureCollection([
turf.point([latitude, longitude]),
turf.point([latitude, longitude])
]);
var user = turf.point([latitude, longitude]);