Skip to content

Instantly share code, notes, and snippets.

def multiples_of_x_less_than_y(x, y)
(1..(y / x)).to_a.map {|z| x * z}
end
(multiples_of_x_less_than_y(3,80) + multiples_of_x_less_than_y(5,80)).uniq.sort.sum
@s2t2
s2t2 / colors.rb
Last active August 29, 2015 13:57
color hexes for data vizualizations
#http://colorbrewer2.org/
COLOR_BREWER_SEQUENTIAL_BLUES = ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]
COLOR_BREWER_SEQUENTIAL_GREENS = ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]
COLOR_BREWER_SEQUENTIAL_GREYS = ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]
COLOR_BREWER_SEQUENTIAL_ORANGES = ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]
COLOR_BREWER_SEQUENTIAL_PURPLES = ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]
COLOR_BREWER_SEQUENTIAL_REDS = ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]
COLOR_BREWER_QUALITATIVE_VIBRANTS = ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"]
COLOR_BREWER_QUALITATIVE_PASTELS = ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3
@s2t2
s2t2 / how to create a mysql database schema vizualization.md
Last active August 29, 2015 14:00
how to create a mysql database schema visualization in ruby on rails.

Step 1: Query the metadata

SELECT 
  table_schema
  ,TABLE_NAME
  ,COLUMN_NAME
  ,ordinal_position
  ,is_nullable
  ,data_type

,column_type

find . -name "*passenger*" -print
@s2t2
s2t2 / README.md
Last active August 29, 2015 14:06 — forked from simzou/README.md
@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 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.

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