Skip to content

Instantly share code, notes, and snippets.

import { formatDefaultLocale } from 'd3-format';
const germanNumberFormat = formatDefaultLocale({
decimal: ',',
thousands: '.',
grouping: [3],
currency: ['€', '']
});
export function numberFormat(num, decimals = 0) {
@moklick
moklick / content.js
Created January 2, 2018 23:06
was ist das fuer 1 extension
// via http://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page#answer-10730777
function findTextNodes(el) {
var node;
var textNodes = [];
var walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while (node = walk.nextNode()) {
textNodes.push(node);
}
return textNodes;
}

Keybase proof

I hereby claim:

  • I am moklick on github.
  • I am moklick (https://keybase.io/moklick) on keybase.
  • I have a public key ASCRAEeOQsPTamLtJzCu8u1sdYvSq43rr2iOmsyPIAU5Qgo

To claim this, I am signing this object:

(function(){
// check browser support
if (!document.querySelectorAll || ![].forEach) {
return false;
}
// search teasers
var teasers = document.querySelectorAll('.teaser-leader-m');
[].forEach.call(teasers, function(d) {
@moklick
moklick / leaflet-crs-mapbox.js
Created April 18, 2016 15:09
A custom CRS for Leaflet in order to display mapbox raster tiles
const customCRS = L.extend({}, L.CRS.Earth, {
projection: L.Projection.SphericalMercator,
transformation: (function () {
var scale = 0.5 / (Math.PI * L.Projection.SphericalMercator.R);
return new L.Transformation(scale, 0.5, -scale, 0.5);
}()),
scale: function (zoom) {
return 512 * Math.pow(2, zoom);
}
});
@moklick
moklick / osmb-testdata.geo.json
Created November 9, 2015 14:56
Test geojson dataset for OSMBuildings.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moklick
moklick / twitter-stars.js
Last active November 4, 2015 13:52
Changes Twitter Hearts To Stars Again
/*
* Get the good old favorite ★ back.
*
* Copy the few lines below into the console of your browser and press enter.
* Chrome: https://developer.chrome.com/devtools#access
* Firefox: https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console
*/
// updated version (this also works for new pulled tweets):
var style = document.createElement('style');
@moklick
moklick / geojson-streaming.js
Last active August 29, 2015 14:20
Boilerplate for processing (read and write) large geojson/json files with streams
// boilerplate for processing large geojson/json files..
// npm install --save through2 JSONStream
var through = require('through2');
var JSONStream = require('JSONStream');
var fs = require('fs');
var inputStream = fs.createReadStream('./test.geojson');
var outputStream = fs.createWriteStream('./cleaned-geojson.json');
@moklick
moklick / gist:57344345e94885c6482f
Created March 9, 2015 20:10
street-extraction
osmfilter uk-latest.osm --keep="addr:country= and addr:city= and addr:street=" --ignore-dependencies --drop-relations --drop-ways | osmconverter - --csv="@oname @id @lon @lat addr:country addr:city addr:street" >> streets.csv
@moklick
moklick / countries.topo.json
Last active April 3, 2020 06:17
Maps with TopoJSON, Leaflet & Chroma.js http://blog.webkid.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.