View FreshThresh.js
// ==UserScript==
// @name FreshThresh
// @namespace github.com/kielni
// @description Hide items from Amazon Fresh via right click menu
// @include https://fresh.amazon.com/*
// @version 1
// @grant none
// ==/UserScript==
/*
View get_san_jose_camps.js
var request = require("request"),
cheerio = require("cheerio"),
_ = require("lodash"),
fs = require("fs"),
readline = require("readline");
var rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt('url> ');
rl.prompt('');
View README.md

d3.legend

d3.legend is a quick hack to add a legend to a d3 chart. Simply add a g and .call(d3.legend). Any elements that have a title set in the "data-legend" attribute will be included when d3.legend is called. Each title will appear only once (even when multiple items define the same data-legend) as the process uses a set based on a existing names, not an array of all items.

Color

By default the color in the legend will try to match the fill attribute or the stroke attribute of the relevant items. Color can be explicitly defined by attribute "data-legend-color"

Order

The order of items in the legend will be sorted using the top of the bounding box for each included item. The order can be explicitly defined by attribute "data-legend-pos"

View README.md

README is empty

View Makefile
go: go.c
gcc -o go -O go.c -Wall -Wextra -std=c11 -ggdb
View README.md

Map where Amazon orders go

The Friends of the Alum Rock library sells books via Amazon to raise money for library programs. We thought it would be fun to see where we send the books.

fetch orders

Amazon makes it surprisingly hard to get programmatic access to order information. They do have an API (Amazon Marketplace Web Service), but it's only available to business sellers.

I wrote a Python script using mechanize that logs in to our seller account, goes to the order page, and clicks each of the orders to get to the order detail page. From there, I used regular expressions to extract the relevant order info (shipping address, date, price, and title). The HTML is not very well marked up, so this is likely to break. I use the MapQuest geocoding API to convert the mailing address to latitude/longitude so it can be mapped easily. I save this data in GeoJSON format, and update it whenever an order comes in. The orders.json file contains some sample data but is not updated automatically.

View index.html
<html>
<head>
<style>
rect {
fill: #D2B48C;
}
.axis path,
.axis line {
fill: none;
View Readme.md

D3 Streamgraph Example

Series Hover

The series hover interactivity uses the technique from lgrammel seen here: http://bl.ocks.org/1963983

Data Tooltip

It isn't necessarily a tooltip, but data is displayed by inverting the x-axis value into a date, and mapping the date to the corresponding data value for the series.

View Readme.md

D3 Streamgraph Example

Series Hover

The series hover interactivity uses the technique from lgrammel seen here: http://bl.ocks.org/1963983

Data Tooltip

It isn't necessarily a tooltip, but data is displayed by inverting the x-axis value into a date, and mapping the date to the corresponding data value for the series.