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 / LICENSE
Last active March 28, 2016 23:27
Leaflet animated markers dragging
Copyright (c) 2016, Vladimir Agafonkin
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@mourner
mourner / kml.js
Created December 18, 2012 11:04
Some old KML parsing code from CloudMade Web Maps API for @tmcw
CM.GeoXML.prototype = {
// ...
_parseKmlStyle: function(obj) {
var style = {};
if (obj.LineStyle) {
if (obj.LineStyle.color) {
var color = this._parseKmlColor(obj.LineStyle.color.$);
style.color = color.rgb;
style.opacity = color.opacity;
//TODO: colorMode=random
@mourner
mourner / README.md
Last active October 7, 2019 13:28
D3 Sun Heatmap example

This is a D3.js Heatmap example showing how the highest sun position of the day (which directly correlates with average temperature) changes over the year depending on the latitude of the place. The actual temperature chart would be shifted to the right a bit beacuse of thermal lag.

The data for the chart is calculated using SunCalc.

@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 / adler32.js
Created November 22, 2013 14:23
Adler 32 checksum implementation in JS
function hash(str) {
for (var i = 0, len = str.length, s1 = 1, s2 = 0; i < len; i++) {
s1 = (s1 + str.charCodeAt(i)) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
@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