Skip to content

Instantly share code, notes, and snippets.

View monkeycycle's full-sized avatar

Michael Pereira monkeycycle

View GitHub Profile
@monkeycycle
monkeycycle / .block
Created April 4, 2017 14:16 — forked from mbostock/.block
Google Maps + D3
license: gpl-3.0
@monkeycycle
monkeycycle / data.csv
Last active April 29, 2017 17:39
Graph with multiple lines and label.
date close open
1-May-12 68.13 34.12
30-Apr-12 63.98 45.56
27-Apr-12 67.00 67.89
26-Apr-12 89.70 78.54
25-Apr-12 99.00 89.23
24-Apr-12 130.28 99.23
23-Apr-12 166.70 101.34
20-Apr-12 234.98 122.34
19-Apr-12 345.44 134.56
@monkeycycle
monkeycycle / data.csv
Last active April 29, 2017 19:57
Single d3 line chart
Date Close
3-31-1992 0.28
4-30-1992 0.2875
5-29-1992 0.275
6-30-1992 0.25
7-31-1992 0.25
8-31-1992 0.225
9-30-1992 0.225
10-30-1992 0.2125
11-30-1992 0.1375
@monkeycycle
monkeycycle / data.csv
Last active April 29, 2017 19:55
D3 column chart
date value
2013-01 53
2013-02 165
2013-03 269
2013-04 344
2013-05 376
2013-06 410
2013-07 421
2013-08 405
2013-09 376
@monkeycycle
monkeycycle / index.html
Last active April 29, 2017 17:46
D3 horizontal bar chart
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Simple Bar chart</title>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
body {
font-family: "Arial", sans-serif;
@monkeycycle
monkeycycle / home-capital-share-value.csv
Created April 29, 2017 17:32
Assorted small data sets
Date Close
3-31-1992 0.28
4-30-1992 0.2875
5-29-1992 0.275
6-30-1992 0.25
7-31-1992 0.25
8-31-1992 0.225
9-30-1992 0.225
10-30-1992 0.2125
11-30-1992 0.1375
@monkeycycle
monkeycycle / chart-title.js
Created April 29, 2017 17:43
Chart title
svg.append("text")
.attr("x", 20)
.attr("y", 0 - (margin.top / 2))
.attr("text-anchor", "start")
.style("font-size", "16px")
.text("Charty title");
@monkeycycle
monkeycycle / make-animated-gifs-using-ffmpeg.md
Created May 8, 2017 13:56 — forked from gka/make-animated-gifs-using-ffmpeg.md
how to make a nice GIF from png frames

Make sure ffmpeg is up-to-date:

brew update
brew upgrade ffmpeg

Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.

@monkeycycle
monkeycycle / multi-crowbar.js
Created May 8, 2017 13:56 — forked from gka/multi-crowbar.js
like svg-crowbar, but for multiple svg elements!
var multiCrowbar = (function() {
/*
* SVG Export
* converts html labels to svg text nodes
* will produce incorrect results when used with multi-line html texts
*
* Author: Gregor Aisch
* based on https://github.com/NYTimes/svg-crowbar/blob/gh-pages/svg-crowbar-2.js
*/
@monkeycycle
monkeycycle / xls2csv.py
Created May 8, 2017 13:56 — forked from gka/xls2csv.py
Excel to CSV
import xlrd
import csv
import sys
def csv_from_excel(fn):
wb = xlrd.open_workbook(fn)
sh = wb.sheet_by_index(0)
your_csv_file = open(fn.replace('xls', 'csv'), 'wb')
wr = csv.writer(your_csv_file, quoting=csv.QUOTE_ALL)
for rownum in xrange(sh.nrows):