Skip to content

Instantly share code, notes, and snippets.

💭
[object Object]

Moritz moklick

💭
[object Object]
Block or report user

Report or block moklick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View german-number-format.js
import { formatDefaultLocale } from 'd3-format';
const germanNumberFormat = formatDefaultLocale({
decimal: ',',
thousands: '.',
grouping: [3],
currency: ['', '']
});
export function numberFormat(num, decimals = 0) {
@moklick
moklick / content.js
Created Jan 2, 2018
was ist das fuer 1 extension
View content.js
// 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;
}
View keybase.md

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:

View teaser-hotfix.js
(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 Apr 18, 2016
A custom CRS for Leaflet in order to display mapbox raster tiles
View leaflet-crs-mapbox.js
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 Nov 9, 2015
Test geojson dataset for OSMBuildings.
View osmb-testdata.geo.json
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 Nov 4, 2015
Changes Twitter Hearts To Stars Again
View twitter-stars.js
/*
* 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 Aug 29, 2015
Boilerplate for processing (read and write) large geojson/json files with streams
View geojson-streaming.js
// 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');
View gist:57344345e94885c6482f
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 May 22, 2019
Maps with TopoJSON, Leaflet & Chroma.js http://blog.webkid.io
View countries.topo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.