Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
learning

Alexander Milevski w8r

💭
learning
View GitHub Profile
@w8r
w8r / hosts
Last active Aug 29, 2015 — forked from dlo/hosts
View hosts
255.255.255.255 006.free-counter.co.uk
255.255.255.255 006.freecounters.co.uk
255.255.255.255 06272002-dbase.hitcountz.net # Web bugs in spam
255.255.255.255 09killspyware.com
255.255.255.255 0stats.com
255.255.255.255 1.adbrite.com
255.255.255.255 1.httpads.com
255.255.255.255 1.primaryads.com
255.255.255.255 102.112.2o7.net
255.255.255.255 102.122.2o7.net
View douglasPeucker.js
var simplifyPath = function( points, tolerance ) {
// helper classes
var Vector = function( x, y ) {
this.x = x;
this.y = y;
};
var Line = function( p1, p2 ) {
this.p1 = p1;
View wsk-watchify.js
/**
*
* Hooking up Watchify with Google's Web Starter Kit
*
* The primary use cases for Browserify/Watchify are:
* - Node.js-style `require`s on the client-side
* - Use of npm modules on the client-side
* - No more new <script> tags for each new script/module
*
* 1. npm install --save-dev vinyl-source-stream browserify watchify gulp-notify
View README.md

Click and drag above to paint red hexagons. A black outline will appear around contiguous clusters of red hexagons. This outline is constructed using topojson.mesh, part of the TopoJSON client API. A filter is specified so that the mesh only contains boundaries that separate filled hexagons from empty hexagons.

The hexagon grid itself is represented as TopoJSON, but is constructed on-the-fly in the browser. Since TopoJSON requires quantized coordinates, the hexagon grid is represented as integers, with each hexagon of dimensions 3×2. Then a custom projection is used to transform these irregular integer hexagons to normal hexagons of the desired size.

@w8r
w8r / index.js
Created Jul 3, 2015
requirebin sketch
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var L = require('leaflet');
console.log(L);
@w8r
w8r / map.geojson
Last active Aug 29, 2015
DOGE spotting
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@w8r
w8r / domtokenlist.js
Last active Dec 30, 2015
IE10+ DOMTokenList fix
View domtokenlist.js
/**
* IE 10 + supports ClassList, but the standards are vague. It is extremely
* convenient to add several classnames at once, FF and Chrome support that.
*
* @author Alexander Milevski <info@w8r.name>
*
* https://gist.github.com/w8r/fbdbfea078629ff913d4
*
* MIT License
*
@w8r
w8r / L.SvgScaleOverlay.js
Last active Jan 11, 2016 — forked from Sumbera/L.SvgScaleOverlay.js
SVG scaled overlay in Leaflet
View L.SvgScaleOverlay.js
/*
Stanislav Sumbera, August , 2015
- scaled SVG draw prototype on top of Leaflet 1.0 beta
- note it uses L.map patch to get it working right
- SVG data are not modified, only scaled and optionaly radius/stroke width etc. can be specified on onScaleChange callback
- very experimental
*/
//-- Patch to get leaflet properly zoomed
@w8r
w8r / laplacian.js
Created Jan 6, 2017
Graph Laplacian
View laplacian.js
function laplacian(G, N) {
var L = new Array(N);
for (var i = 0; i < N; i++) {
var row = new Array(N);
var node = G.nodes[i];
for (var j = 0; j < N; j++) {
if (i === j) {
row[j] = node.edges.length;
} else {
row[j] = (node.edges.indexOf(j) === -1) ? -1 : 0;
You can’t perform that action at this time.