Skip to content

Instantly share code, notes, and snippets.

View kielni's full-sized avatar

Kimberly Nicholls kielni

View GitHub Profile
@kielni
kielni / Readme.md
Last active April 10, 2018 17:29 — forked from WillTurman/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.

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.

@kielni
kielni / index.html
Last active August 29, 2015 13:56
d3 order processing
<html>
<head>
<style>
rect {
fill: #D2B48C;
}
.axis path,
.axis line {
fill: none;
@kielni
kielni / README.md
Last active August 29, 2015 13:57
Map where Amazon orders go

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.

@kielni
kielni / Makefile
Last active August 29, 2015 13:57 — forked from raylu/Makefile
go: go.c
gcc -o go -O go.c -Wall -Wextra -std=c11 -ggdb
@kielni
kielni / README.md
Created June 20, 2014 14:57
Acme Ventures meter 1-forecasts

README is empty

@kielni
kielni / README.md
Last active August 29, 2015 14:06 — forked from ZJONSSON/README.md
d3.legend with line or circle icons

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"

@kielni
kielni / get_san_jose_camps.js
Created February 15, 2015 05:20
Extract title and description of City of San Jose camp from URL and append to a text file
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('');
@kielni
kielni / FreshThresh.js
Last active August 29, 2015 14:26
Greasmonkey script to hide items on Amazon Fresh category pages that are not on my list, so I can find the stuff I do want. Right click an item picture, then click Not on my list to hide the item. Demo: https://www.youtube.com/edit?video_id=mTDQGyF3Zvs
// ==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==
/*
@kielni
kielni / deploy.py
Created October 22, 2017 17:33
command line deploy for python AWS lambda functions
import base64
import os
import zipfile
import boto3
'''
create zip, update function code, invoke function, and print result
set in environment: