Skip to content

Instantly share code, notes, and snippets.

View eSlivinski's full-sized avatar
🤨

Lizzi Slivinski eSlivinski

🤨
View GitHub Profile
@eSlivinski
eSlivinski / data.json
Last active September 20, 2018 13:46
connectors
{
"nodes": [
{"id": "MP-1", "type": "MP" },
{"id": "MP-2", "type": "MP" },
{"id": "SP-1", "type": "SP" },
{"id": "SP-2", "type": "SP" },
{"id": "SP-3", "type": "SP" },
{"id": "SP-4", "type": "SP" },
{"id": "SP-5", "type": "SP" },
{"id": "SP-6", "type": "SP" },
@eSlivinski
eSlivinski / pageToScreen.js
Created August 11, 2017 14:12
Page size to screen size conversion
const dpi = 72; // dots per inch (ie. resolution)
const factor = 2.54; // convert inches to cm
const dpcm = dpi / factor; // dots per cm
/**
* Calculate the phantom browser's paper size property based on the
* desired size of the export document
* @param {Number} [widthIn] Width in inches of phantom export doc
* @param {Number} [heightIn] Height in inches of phantom export doc
* @param {String} [orientation] Paper orientation of phantom export doc
@eSlivinski
eSlivinski / IconContent.js
Last active August 27, 2018 02:03
Leaflet SVG Icon Font Markers
IconContent = {
'fa-500px': "&#xf26e",
'fa-address-book': "&#xf2b9",
'fa-address-book-o': "&#xf2ba",
'fa-address-card': "&#xf2bb",
'fa-address-card-o': "&#xf2bc",
'fa-adjust': "&#xf042",
'fa-adn': "&#xf170",
'fa-align-center': "&#xf037",
'fa-align-justify': "&#xf039",
@eSlivinski
eSlivinski / index.html
Last active April 8, 2017 18:35
US Highways Simplified
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<style>
.state {
fill: #aaa;
stroke: #ddd;
}
@eSlivinski
eSlivinski / d3.hexbin.min.js
Last active March 14, 2017 01:49
Fatal Force Hexbins
!function(){d3.hexbin=function(){function u(n){var r={};return n.forEach(function(n,t){var a=s.call(u,n,t)/o,e=Math.round(a),c=h.call(u,n,t)/i-(1&e?.5:0),f=Math.round(c),l=a-e;if(3*Math.abs(l)>1){var v=c-f,g=f+(f>c?-1:1)/2,m=e+(e>a?-1:1),M=c-g,d=a-m;v*v+l*l>M*M+d*d&&(f=g+(1&e?1:-1)/2,e=m)}var j=f+"-"+e,p=r[j];p?p.push(n):(p=r[j]=[n],p.i=f,p.j=e,p.x=(f+(1&e?.5:0))*i,p.y=e*o)}),d3.values(r)}function a(r){var t=0,u=0;return n.map(function(n){var a=Math.sin(n)*r,e=-Math.cos(n)*r,i=a-t,o=e-u;return t=a,u=e,[i,o]})}var e,i,o,c=1,f=1,h=r,s=t;return u.x=function(n){return arguments.length?(h=n,u):h},u.y=function(n){return arguments.length?(s=n,u):s},u.hexagon=function(n){return arguments.length<1&&(n=e),"m"+a(n).join("l")+"z"},u.centers=function(){for(var n=[],r=0,t=!1,u=0;f+e>r;r+=o,t=!t,++u)for(var a=t?i/2:0,h=0;c+i/2>a;a+=i,++h){var s=[a,r];s.i=h,s.j=u,n.push(s)}return n},u.mesh=function(){var n=a(e).slice(0,4).join("l");return u.centers().map(function(r){return"M"+r+"m"+n}).join("")},u.size=function(n){return arg
@eSlivinski
eSlivinski / index.html
Last active March 4, 2017 23:17
Mapping Random Data With D3
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<style>
.state {
stroke: rgba(0,0,0,0.4);
}