Skip to content

Instantly share code, notes, and snippets.

/*
EXAMPLE MESSAGE
/poll "question?" "option 1" "option 2"
*/
/** Global Helpers
*
* console - A normal console instance
* _ - An underscore instance
@Andygol
Andygol / overpass.md
Created March 13, 2016 21:49 — forked from planemad/overpass.md
Uploading OSM data to Mapbox using an overpass query

If you have been playing around with the new Mapbox Studio you might be interested to know how to make a custom map with objects of your own interest from OpenStreetMap.

To make the process of creating an updating an OSM based dataset on Mapbox more seamless, I was looking into a command line based workflow that could extract OSM data from Overpass and update a Mapbox hosted dataset in one go.

Requirements

Generate an Overpass Query

  • Use Overpass Turbo to create a query for the data you are interested in extracting. Since i'm interested in bus stops, I first browse the map to Bengaluru, India and then generate a query using the wizard query highway=bus_stop
@tyrasd
tyrasd / README.md
Last active February 2, 2016 15:25
🚲 Bikeability Index Graz – http://bl.ocks.org/tyrasd/f60119bbd9105154d872/
// CSV Output
[out:csv(name, ::"lat", ::"lon")];
{{geocodeArea:CH}}->.searchArea;
// gather results
(
// query part for: “place”
(node["place"]["name"~"^.+$"](area.searchArea);)
);
out body;
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
@mmrko
mmrko / git-add-no-whitespace.sh
Last active March 14, 2023 21:09
git add files ignoring whitespace
# props: https://stackoverflow.com/questions/3515597/add-only-non-whitespace-changes#answer-7149602
git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero
@curran
curran / README.md
Last active July 16, 2018 19:19
Map & Globe

Pan and zoom in the map on the left to rotate the globe.

Click and drag the globe to pan on the map.

An example that shows a Chiasm plugin based on Leaflet.js alongside a Chiasm globe plugin based on the D3 example This is a Globe.

The Chiasm plugins demonstrated here are

@qntm
qntm / multiline.js
Last active October 16, 2023 12:39
// TODO: longer method name
Function.prototype.extractBlockCommentAsMultilineString = function() {
return this.toString().match(/^function \(\)\{\s*\/\*((?:[^*]|\*+[^*\/])*)\*+\/\s*\}$/)[1];
};
var s = function(){/*
STRING
GOES
HERE
*/}.extractBlockCommentAsMultilineString();
@nolanlawson
nolanlawson / protips.js
Last active November 19, 2024 02:40
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
anonymous
anonymous / map.geojson
Created January 14, 2015 11:04
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.