Skip to content

Instantly share code, notes, and snippets.

@travisdoesmath
travisdoesmath / illinois.json
Created December 30, 2015 20:41
Chicago Grid
{ "type": "Feature", "properties": { "GEO_ID": "0400000US17", "STATE": "17", "NAME": "Illinois", "LSAD": "", "CENSUSAREA": 55518.930000 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -87.532331, 39.997776 ], [ -87.532542, 39.987462 ], [ -87.532683, 39.977691 ], [ -87.532790, 39.975010 ], [ -87.532776, 39.971077 ], [ -87.533227, 39.883127 ], [ -87.533142, 39.810947 ], [ -87.533056, 39.803922 ], [ -87.533058, 39.796243 ], [ -87.533066, 39.781743 ], [ -87.532703, 39.664868 ], [ -87.532444, 39.646102 ], [ -87.532365, 39.646126 ], [ -87.532008, 39.564013 ], [ -87.531939, 39.545853 ], [ -87.531965, 39.526937 ], [ -87.531692, 39.495516 ], [ -87.531627, 39.491698 ], [ -87.531663, 39.477120 ], [ -87.531624, 39.469378 ], [ -87.531608, 39.466225 ], [ -87.531489, 39.449474 ], [ -87.531355, 39.437732 ], [ -87.531355, 39.436656 ], [ -87.531646, 39.347888 ], [ -87.544013, 39.352907 ], [ -87.554400, 39.340488 ], [ -87.578331, 39.340343 ], [ -87.589084, 39.333831 ], [ -87.600397, 39.312904 ], [ -87.597946, 39.299479
@travisdoesmath
travisdoesmath / README.md
Created December 6, 2016 18:44
Archimedean Ulam Spiral

What does it look like if we extend the idea behind Ulam's spiral and look at prime lengths of the Archimedean spiral?

Sadly, not like much.

@travisdoesmath
travisdoesmath / index.html
Last active July 14, 2017 03:48
States I've Visited
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js"></script>
<style type="text/css">
/* On mouse hover, lighten state color */
path:hover {
fill-opacity: .7;
@travisdoesmath
travisdoesmath / index.html
Last active December 26, 2017 10:14
Golden Spiral Squares
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: black;
}
.square {
fill: none;
stroke-width: 1.5px;
}
@travisdoesmath
travisdoesmath / README.md
Last active December 28, 2017 20:38
Double pendulum simulator

A double pendulum simulator using a Runge-Kutta integrator.

@travisdoesmath
travisdoesmath / index.html
Last active December 28, 2017 20:39
Animated Golden Ratio Squares
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: black;
}
.square {
fill: none;
fill-opacity: 0.75;
/*stroke-opacity: 0.1;*/
@travisdoesmath
travisdoesmath / double_pendulum.js
Last active January 6, 2018 13:40
Double Pendulums are Chaotic
Array.prototype.scalarMultiply = function(x) { return this.map(function(d) { return x * d; }); }
var l1 = 1, l2 = 1,
m1 = 1, m2 = 1,
G = 9.8;
var theta1 = 0.49*Math.PI,
theta2 = 1.0*Math.PI,
p1 = 0,
p2 = 0;
@travisdoesmath
travisdoesmath / data.csv
Last active November 13, 2019 03:54
Comfy Weather
We can't make this file beautiful and searchable because it's too large.
,STNID,min_temp,max_temp,annual_precipitation,Latitude,Longitude,Name,FIPS_COUNTY,COUNTY_NAME,AVG_WEEKLY_WAGE
0,USC00010063,28.5,90.1,58.24,34.2553,-87.1814,ADDISON,01133,"Winston County, Alabama",721
1,USC00010160,31.4,90.9,55.62,32.9453,-85.9481,ALEXANDER CITY,01123,"Tallapoosa County, Alabama",645
2,USC00011324,25.8,91.7,53.66,32.8236,-85.6561,CAMP HILL 2NW,01123,"Tallapoosa County, Alabama",645
3,USC00010178,31.0,92.7,56.17,33.1272,-88.155,ALICEVILLE,01107,"Pickens County, Alabama",735
4,USC00010252,31.9,91.8,59.97,31.3072,-86.5225,ANDALUSIA 3 W,01039,"Covington County, Alabama",693
5,USC00010260,26.4,89.8,57.93,34.9092,-87.2747,ANDERSON,01077,"Lauderdale County, Alabama",674
6,USC00010369,29.4,89.9,58.15,33.2942,-85.7789,ASHLAND 3 ENE,01027,"Clay County, Alabama",661
7,USC00010390,29.8,90.2,56.89,34.7753,-86.9508,ATHENS,01083,"Limestone County, Alabama",917
8,USC00010655,27.3,91.2,53.21,34.6908,-86.8825,BELLE MINA 2 N,01083,"Limestone County, Alabama",917
@travisdoesmath
travisdoesmath / app.js
Last active April 19, 2020 05:26
Double Pendulums are Still Chaotic
var nPendulums = 60;
var pendulums = d3.range(nPendulums).map(x => new Pendulum({m2: 1 + 0.01*x/nPendulums, theta1:0.75*Math.PI}))
var fadeBackground = true;
var svg = d3.select("svg")
width = +svg.attr("width"),
height = +svg.attr("height"),
@travisdoesmath
travisdoesmath / golden.js
Last active April 20, 2020 08:35
Un/curling Golden Squares with Continuous Intermediate Squares
function generateTransformations(T, n) {
let T_n = {scale:1, angle:0, t_x:0, t_y:0};
let matrices = [T_n];
for (let i = 0; i < n; i++) {
T_n = composeTransformations(T_n, T)
matrices.push(T_n);
}
return matrices
}