Skip to content

Instantly share code, notes, and snippets.

View brendansudol's full-sized avatar

Brendan Sudol brendansudol

View GitHub Profile
@brendansudol
brendansudol / part2.mdown
Created January 10, 2012 05:52
Brendan Sudol - Part 2

Efficient Market Hypothesis, from Economics

When it comes to investing, many economists believe that a blindfolded monkey throwing darts at a newspaper’s financial pages could select a portfolio of stocks that would do just as well as Wall Street professionals. The idea that picking good stocks is just a matter of luck comes from a fundamental theory in financial economics known as the Efficient Market Hypothesis (EMH).

Introduced by Eugene Fama in the 1960s, the essence of EMH is that at any

@brendansudol
brendansudol / README.md
Last active October 24, 2016 00:41
circles and colors
@brendansudol
brendansudol / learn_d3.md
Created July 23, 2012 13:04
Learning D3 - a (possibly) helpful roadmap

Learning D3

1. Read Up

Spend a few hours (minimum) going through these materials. It's okay if you don't understand half of it on your first time through (75% is way too much though). I found it super helpful to write out the code snippets and test them out while following along. There are now quite a few D3 tutorials out there, but I found these particularly helpful:

  1. Intro by Mike Bostock, D3 Creator
  2. D3 Workshop (just skim through)
  3. Three Little Circles
  4. A Bar Chart
@brendansudol
brendansudol / index.html
Last active October 24, 2016 00:42
bar chart constancy
<!doctype html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<link type="text/css" rel="stylesheet" href="style.css"/>
<style type="text/css"></style>
</head>
<body>
<p id="chart">
<p id="menu"><b>Top States by Age Bracket, 2008</b><br>Age: <select></select>
cat 1/*.txt 2/*.txt 3/*.txt 4/*.txt 5/*.txt > combined.txt
awk '{arr[$1]+=1} END {for (i in arr) {print i,arr[i]}}' combined.txt > counts.txt
sort -nrk 2 counts.txt
hello, world
@brendansudol
brendansudol / colorz.js
Created July 14, 2013 17:25
A D3.js recreation of Etsy's shopping by color animation.
var width = 660,
height = 600;
var color = d3.scale.linear()
.domain([0, width/4, width/4 * 2, width/4 * 3, width])
.range(["#fb000f", "#6e00fb", "#00fbec", "#8dfb00", "#fb3c00"])
.interpolate(d3.interpolateHsl);
var svg = d3.select("#colorz").append("svg")
.attr("width", width)
(function(){
var width = 660,
height = 460;
var edById = {},
nameById = {};
var formatNum = d3.format(",.0f"),
formatPercent = d3.format(",.0%");
(function(){
// select grouped radio button (since i couldn't seem to do it in markdown)
d3.select('input[value="grouped"]').property('checked', true);
var data = [
[
{x: 'A', y: 1102, z: 'Brazil'}, {x: 'B', y: 1507, z: 'Spain'}, {x: 'C', y: 1200, z: 'Columbia'}, {x: 'D', y: 1132, z: 'Uruguay'},
{x: 'E', y: 1113, z: 'Switzerland'}, {x: 'F', y: 1251, z: 'Argentina'}, {x: 'G', y: 1318, z: 'Germany'}, {x: 'H', y: 1098, z: 'Belgium'}
],
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="x-ua-compatible" content="IE=9" >
<title>Title</title>