Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamgreenhall
adamgreenhall / README.md
Last active December 15, 2015 19:39 — forked from huyng/matplotlibrc
Style tweaks for matplotlib

This implements a nicer color scheme for matplotlib, along with some other styling tweaks.

To install:

cd ~/.matplotlib
cp matplotlibrc backup_matplotlibrc
git clone https://gist.github.com/adamgreenhall/5312535 newrc

cp newrc/matplotlibrc .

@adamgreenhall
adamgreenhall / df2json.py
Last active October 12, 2019 21:13 — forked from ameliagreenhall/df2json.py
Convert pandas.DataFrame to JSON (and optionally write the JSON blob to a file).
"""
tiny script to convert a pandas data frame into a JSON object
"""
import json as json
def df_to_json(df, filename=''):
x = df.reset_index().T.to_dict().values()
if filename:
with open(filename, 'w+') as f: f.write(json.dumps(x))
@adamgreenhall
adamgreenhall / index.html
Created August 8, 2012 17:50 — forked from mbostock/.block
D3 and Custom Data Attributes
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.4.6"></script>
</head>
<body>
<ul id="list">
<li data-username="shawnbot">Shawn Allen</li>
<li data-username="mbostock">Mike Bostock</li>
</ul>
@adamgreenhall
adamgreenhall / index.html
Created October 7, 2011 01:05 — forked from mbostock/.block
Axis Component
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@adamgreenhall
adamgreenhall / index.html
Created September 29, 2011 08:52 — forked from jdonaldson/index.html
a tipsy example with changing data
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>index</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/mbostock/d3/master/d3.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/bigmlcom/tipsy/master/src/javascripts/jquery.tipsy.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="http://onehackoranother.com/projects/jquery/tipsy/stylesheets/tipsy.css" type="text/css" title="no title" charset="utf-8">
</head>