Skip to content

Instantly share code, notes, and snippets.

@mtaptich
mtaptich / README.md
Last active January 8, 2016 22:13
100-yr GWP
@mtaptich
mtaptich / README.md
Created January 11, 2016 19:33
Impulse Response
@mtaptich
mtaptich / README.md
Last active January 27, 2016 23:50
Dot Map + d3.js

A framework for creating Dot Maps in d3.js using d3.geom.quadtree and Mitchell’s Best-Candidate (MBC) algorithm as its backbone. Here, I show the percentage of California residents who rent on a county basis.

The rendering speed is very slow due to the recursive MBC calls and small circle areas. However, it is worth the wait if all you are trying to do is download a map for a report.

@mtaptich
mtaptich / README.md
Last active January 28, 2016 19:30
Grid Map

A simple simple way to represent percentages on a map. Data: Percentage of residents who rent.

We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 58 columns, instead of 7 in line 2.
exporting_country,United States,China,Germany,France,United Kingdom,Japan,Italy,Canada,Korea,Spain,Netherlands,India,Mexico,Belgium,Russian Federation,Australia,Switzerland,Chinese Taipei,Brazil,Singapore,Poland,Ireland,Sweden,Saudi Arabia,Austria,Malaysia,Turkey,Thailand,Denmark,Indonesia,Czech Republic,Norway,Greece,Finland,Hungary,"Hong Kong, China",Portugal,Viet Nam,South Africa,Luxembourg,Israel,Slovak Republic,Romania,Philippines,Argentina,Chile,New Zealand,Bulgaria,Slovenia,Lithuania,Latvia,Estonia,Cyprus,Cambodia,Malta,Iceland,Brunei Darussalam
United States,1,111955.9,74435,51782.3,77745.3,89562.1,24319.9,213176.9,44279.2,21442.1,33111.1,28761.5,126533.1,15768.9,13912.6,28923.3,12717.2,24182.8,33361.2,25467.1,6441.3,44732.8,11847.8,18816.2,6383.9,19952.4,9994.3,12478.9,9168.9,11288.5,3893.6,8359.9,6815.9,5666.1,4141.2,9852.9,2673.7,4453.2,7556.4,5353.9,11168.5,1673.4,1887.7,8626.4,8175.5,9872.5,4132.5,1114.5,1297.4,778,656.4,676,734.7,843.3,635,687.3,592.7
China,289963.9,1,68753.2,42191.1,39545.3,111
@mtaptich
mtaptich / README.md
Last active May 28, 2019 05:09
Simple Traveler

Simple example of displaying a route in Leaflet using d3.js.

@mtaptich
mtaptich / README.md
Last active March 8, 2016 03:25
Canvas + Interpolate

Particles flowing along a gradient.

@mtaptich
mtaptich / README.md
Last active March 15, 2016 21:58
Knapsack Table

A simple example of 0/1 Knapsack Problem Dynamic Programming in d3.js.

Items are first ranked according to weight. Next, at each stage (e.g., item:capacity combination) in the algorithm, the model assesses whether adding a new item (row) improves the solution at that paritcular weight capacity (column). If so, it adds the new item and updates the best solution; otherwise, it obtains the previous best solution. Click the tiles to examine each step.

Once the final solution is found, the model back calculates the optimum item set. Rows with highlighted tiles (blue) correspond to items in this set.

Note: This model purposefully shows only one solution. Can you determine when multiple solutions exist?

@mtaptich
mtaptich / README.md
Last active March 16, 2016 02:28
Bus Fuel Consumption

A simple interface for visualizing the marginal effects on fuel combustion given a change in vehicle attributes.

@mtaptich
mtaptich / README.md
Last active June 23, 2016 20:15
EIO-LCA Visualization

Economic Input-Output Life Cycle Assessment (EIO-LCA) is a method to quantify the material, energy, and environmental impacts resulting from activities in our economy. The Economic Input-Output (EIO) method was first formalized by Nobel Prize winning economist, Wassily Leontief, in the 1970s. It took two decades before the computation performance of modern computers was sufficient enough to utilize this model at scale. Since the mid-1990s, EIO-LCA has been used to estimate economy-wide environmental impacts of many products and services, such as automobiles, refrigerators, computers, paper, retail trade, food systems, etc.

In this illustrative example, I model a simple economy consisting of three industrial sectors: steel, electric