Skip to content

Instantly share code, notes, and snippets.

@s2t2
s2t2 / README.md
Last active August 29, 2015 14:11 — forked from gisminister/README.md

The map shows traffic accidents recorded in Oslo, Norway, for the year 2013.

The Leaflet Markercluster plugin is wonderful. Since the markerclusters are divIcons you can put whatever you want inside them using the iconCreateFunction. I wanted my clusters to reveal more information than just the marker count and figured a pie chart would do the job. So I told the iconCreateFunction to do some D3 magic and this is the result.

The example is a bit more complicated than necessary due to how my dataset is structured. But if you take a look at the defineClusterIcon() function you'll see that I use d3.nest() to build a dataset for the pie chart based on a given property from all the cluster's children. Then I pass this dataset over to the bakeThePie() function together with instructions on how to style the chart. The function returns svg markup which in turn is placed inside the divIcon.

Feel free to suggest improvements.

@s2t2
s2t2 / chef_node_configuration.json
Last active August 29, 2015 14:09
configurations
{
"ebs_directory_path":"/___",
"environment_variables":{
"_________":"_________",
"_______":"______"
},
"mysql":{
"server_root_password":"_______",
"data_dir":"_________",
"port":"_____"
@s2t2
s2t2 / amzn.csv
Last active August 29, 2015 14:07 — forked from lebek/amzn.csv
date close
2014-02-07 361.08
2014-02-06 354.59
2014-02-05 346.45
2014-02-04 347.95
2014-02-03 346.15
2014-01-31 358.69
2014-01-30 403.01
2014-01-29 384.2
2014-01-28 394.43
@s2t2
s2t2 / query_results_example.md
Last active December 30, 2015 07:32
Google Analytics Reporting API Requests via Legato Ruby Gem

Objective 1: Make a single request that returns an array of results, each representing a unique set of daily values.

class UserMeasurebyDay
  extend Legato::Model
  metrics :users, :new_users, :percent_new_sessions
  dimensions :date
end
@s2t2
s2t2 / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

Some of these files are from the us-atlas:

  • us.json - make topo/us-10m.json
  • us-congress-113.json - make topo/us-congress-10m.json

Others are from the world-atlas:

  • world-50m.json - make topo/world-50m.json
  • world-110m.json - make topo/world-110m.json
{"type":"MultiPolygon","coordinates":[[[[-155.59,20.14],[-155.58,20.13],[-155.57,20.13],[-155.56,20.14],[-155.55,20.14],[-155.53,20.14],[-155.49,20.11],[-155.45,20.11],[-155.34,20.06],[-155.21,20],[-155.17,19.97],[-155.09,19.88],[-155.08,19.87],[-155.08,19.84],[-155.08,19.77],[-155.07,19.74],[-155.06,19.74],[-155.02,19.75],[-154.99,19.74],[-154.98,19.73],[-154.98,19.72],[-154.97,19.67],[-154.96,19.65],[-154.92,19.61],[-154.87,19.59],[-154.79,19.54],[-154.8,19.52],[-154.81,19.5],[-154.82,19.48],[-154.83,19.46],[-154.91,19.42],[-154.92,19.41],[-155.01,19.33],[-155.02,19.33],[-155.05,19.32],[-155.07,19.32],[-155.1,19.3],[-155.17,19.28],[-155.19,19.28],[-155.27,19.28],[-155.29,19.27],[-155.3,19.27],[-155.32,19.25],[-155.35,19.22],[-155.37,19.22],[-155.38,19.21],[-155.4,19.2],[-155.42,19.18],[-155.44,19.17],[-155.49,19.14],[-155.5,19.14],[-155.55,19.1],[-155.55,19.08],[-155.57,19.03],[-155.61,18.97],[-155.63,18.96],[-155.64,18.95],[-155.66,18.93],[-155.67,18.93],[-155.67,18.94],[-155.69,18.96],[-155.71,18.99],[-15
@s2t2
s2t2 / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

These county, state and country boundaries are extracted from a single TopoJSON file. Counties are stroked in thin gray, states in thin black, and the country in thick black.

@s2t2
s2t2 / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

Some of these files are from the us-atlas:

  • us.json - make topo/us-10m.json
  • us-congress-113.json - make topo/us-congress-10m.json

Others are from the world-atlas:

  • world-50m.json - make topo/world-50m.json
  • world-110m.json - make topo/world-110m.json
@s2t2
s2t2 / README.md
Last active August 29, 2015 14:06 — forked from simzou/README.md
find . -name "*passenger*" -print