Skip to content

Instantly share code, notes, and snippets.

{"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

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 / 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 / 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 / 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 / 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_cookbook_organization_alternatives.md
Last active August 29, 2015 14:12
Organizing a Chef cookbook, need to access node attributes across recipes, trying to avoid using `Chef::Recipe.send(:include, MyHelper)`

As-Is

# my_cookbook/recipes/default.rb
root_mysql_connection = {
  :host => "localhost",
  :username => "root",
  :password => node["mysql"]["server_root_password"]
}
{"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"Alabama","density":94.65},"geometry":{"type":"Polygon","coordinates":[[[-87.359296,35.00118],[-85.606675,34.984749],[-85.431413,34.124869],[-85.184951,32.859696],[-85.069935,32.580372],[-84.960397,32.421541],[-85.004212,32.322956],[-84.889196,32.262709],[-85.058981,32.13674],[-85.053504,32.01077],[-85.141136,31.840985],[-85.042551,31.539753],[-85.113751,31.27686],[-85.004212,31.003013],[-85.497137,30.997536],[-87.600282,30.997536],[-87.633143,30.86609],[-87.408589,30.674397],[-87.446927,30.510088],[-87.37025,30.427934],[-87.518128,30.280057],[-87.655051,30.247195],[-87.90699,30.411504],[-87.934375,30.657966],[-88.011052,30.685351],[-88.10416,30.499135],[-88.137022,30.318396],[-88.394438,30.367688],[-88.471115,31.895754],[-88.241084,33.796253],[-88.098683,34.891641],[-88.202745,34.995703],[-87.359296,35.00118]]]}},
{"type":"Feature","id":"02","properties":{"name":"Alaska","density":1.264},"geometry":{"type":"MultiPolygon
@s2t2
s2t2 / eastcoast_cities.geojson
Created January 7, 2015 18:30
source: mapbox.com/mapbox.js/assets/data/eastcoast_cities.geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s2t2
s2t2 / my_recipe.md
Last active August 29, 2015 14:13
how to install rake via rbenv chef cookbook rbenv_gem

Attempt 1:

Follow the instructions

rbenv_gem "rake" do
  ruby_version node["ruby_version"]
  version "10.3.2"
end