Skip to content

Instantly share code, notes, and snippets.

View mourner's full-sized avatar
🔥
making stuff faster

Volodymyr Agafonkin mourner

🔥
making stuff faster
View GitHub Profile
@mourner
mourner / get-trees.js
Created December 15, 2015 19:28
Get trees from OSM using node-osmium
'use strict';
var osmium = require('osmium');
var file = new osmium.File("../mbtiles/us-west-latest.osm.pbf");
var reader = new osmium.Reader(file, {node: true});
var trees = 0;
process.stdout.write('[');
@mourner
mourner / get-trees.cpp
Last active December 17, 2015 02:32
Get all OSM trees into JSON using libosmium
// g++ or clang++ -o get-trees get-trees.cpp -O3 -DNDEBUG -I../libosmium/include -std=c++11 -lz -lpthread
#include <exception>
#include <vector>
#include <iostream>
#include <iomanip>
#include <osmium/handler.hpp>
#include <osmium/io/pbf_input.hpp>
#include <osmium/visitor.hpp>
@mourner
mourner / cliplog.js
Last active December 17, 2015 02:49
A bookmarklet for generating changelog lines from GitHub pull request and commit pages.
javascript: (function() {
var input = document.createElement('input');
input.type = 'text';
input.style.width = '100%';
var issues = Array.prototype.map.call(document.querySelectorAll('.issue-link'), function(link) {
return '[' + link.innerHTML + '](' + link.href + ')';
});
var url = window.location.href,
@mourner
mourner / index.html
Last active December 18, 2015 12:09
Leaflet, Jony Ive edition
<!doctype html>
<html>
<head>
<title>Leaflet, Jony Ive edition</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" /><![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
@mourner
mourner / dc-sprint-backlog.md
Last active December 19, 2015 00:39
Backlog for DC Leaflet Code Sprint.

Leaflet Code Sprint Backlog

Functionality

  • Release 0.6 stable
  • TileLayer / GridLayer refactoring
  • Projections refactoring (removing spherical Earth hardcode, making flat maps usage simpler)
  • Rebuild Easey-style animation capabilities
  • Resolve issues with the opacity API (#1474) so that we can reliably use setOpacity with multi-layered maps
  • Decide on improvements to the geoJSON layer API that let users manipulate layer contents without being exposed to LayerGroup APIs.
@mourner
mourner / fitgrit.md
Last active December 20, 2015 06:59
FitGrit — a minimalistic fitness logging app that stays out of your way (concept)

FitGrit

FitGrit is an upcoming minimalistic app for tracking your workouts that stays out of your way.

This document describes the concept. I'll start developing it as an open source app once I figure out all the basic details of the concept.

The idea came out of frustration from existing fitness tracking apps and a simple Google Drive spreadsheet that I found much more convenient despite not being tailored for fitness.

Main concepts:

@mourner
mourner / index.md
Last active December 28, 2015 08:49
Leaflet 0.7 and plans for future

For the last and the ongoing week, apart from a few days speaking at a conference in Tallin, I've been focused on pushing Leaflet towards the next stable release, 0.7.

This is a bugfix-heavy release — as Leaflet becomes more and more stable feature-wise, the focus shifts towards stability, usability and API improvements over new features. I've also been holding back some of the planned deep refactorings (which I'll talk about later in the post) until 0.7 is released, so that the heavy risky stuff is done at the beginning of the release cycle, leaving plenty of room to catch bugs and incompatible changes that can unintentionally break existing apps.

0.7 changes

You can check out the [detailed changelog](https://g

@mourner
mourner / leaflet-vectors.md
Last active December 30, 2015 12:29
Leaflet vector layers refactoring

Leaflet vector layers refactoring

The goal is to refactor vector layers code in Leaflet to make it possible to use different rendering backends (Canvas, SVG, etc.) for different layers on the same map and switch between them easily, in addition to much cleaner and more transparent code. This will also open it up for interesting extensions, like custom shapes, indexing layers with RBush for fast interaction features, etc.

This is the file structure / responsibilities breakdown I currently have in mind for this.

Files & Classes

class description
@mourner
mourner / index.html
Last active January 1, 2016 06:19
Swipe vector layers in Leaflet master
<!DOCTYPE html>
<html>
<head>
<title>Swipe vector layers in Leaflet</title>
<link rel="stylesheet" href="http://leaflet-cdn.s3.amazonaws.com/build/master/leaflet.css" />
<script src="http://leaflet-cdn.s3.amazonaws.com/build/master/leaflet.js"></script>
<style>
#map {
@mourner
mourner / debug.js
Last active March 1, 2016 15:27
Test
'use strict';
var polyclip = require('./');
var subject = [[3116,3071],[3118,3068],[3108,3102],[3100,3105],[3096,3113],[3099,3121],[3091,3135],[3099,3133],[3105,3144],[3113,3144],[3105,3143],[3117,3157],[3129,3155],[3137,3167],[3152,3177],[3160,3187],[3172,3204],[3174,3195],[3179,3217],[3197,3225],[3189,3217],[3203,3217],[3199,3202],[3186,3188],[3186,3174],[3174,3166],[3165,3145],[3168,3143],[3159,3143],[3151,3118],[3154,3107],[3165,3110],[3174,3105],[3175,3082],[3186,3076],[3178,3089],[3183,3103],[3196,3116],[3181,3105],[3180,3111],[3155,3111],[3173,3130],[3179,3150],[3197,3170],[3199,3178],[3216,3190],[3214,3203],[3235,3219],[3243,3212],[3244,3198],[3246,3208],[3244,3219],[3236,3240],[3237,3249],[3248,3262],[3263,3267],[3327,3313],[3338,3327],[3340,3340],[3351,3349],[3353,3361],[3345,3365],[3355,3387],[3363,3392],[3364,3401],[3375,3413],[3382,3421],[3394,3431],[3404,3433],[3398,3416],[3406,3433],[3409,3422],[3428,3400],[3423,3392],[3446,3377],[3461,3366],[3495,3354],[3506,3343],[3506,3334],[3495,3338],[35