Skip to content

Instantly share code, notes, and snippets.

View ESeufert's full-sized avatar

Eric Benjamin Seufert ESeufert

View GitHub Profile
@ESeufert
ESeufert / index.html
Last active April 14, 2018 18:19
A simple line chart example using D3.js
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<head>
<title>D3.js Dashboard Introduction</title>
<script src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script>
function getMaxObjectValue(this_array, element) {
@ESeufert
ESeufert / index.html
Created August 21, 2012 19:38
A set of line charts using D3.js
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<head>
<title>D3.js Dashboard Introduction</title>
<script src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script>
function getMaxObjectValue(metric, graph_metric) {
@ESeufert
ESeufert / index.html
Created August 23, 2012 07:59
A D3.js dashboard with a console for selecting dimensions
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<head>
<title>D3.js Dashboard Introduction</title>
<script src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script>
function getMaxObjectValue(metric, graph_metric) {
@ESeufert
ESeufert / tweetScroll.class.php
Created October 25, 2012 19:21
tweetScroll -- a PHP class for archiving Twitter timelines
<?php
class tweet_scroll {
/******************************************************************
** database access constants **
** edit these **
******************************************************************/
private $dbName = 'YOUR MYSQL DATABASE NAME';
private $dbHost = 'YOUR MYSQL DATABASE HOST';
private $dbUser = 'YOUR MYSQL DATABASE USERNAME';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>
Minimum Viable Metrics dashboard template - ufert.se
</title>
<link href="https://raw.github.com/ESeufert/MVM-Dashboard-Template/master/nvd3-master/src/nv.d3.css" rel="stylesheet" type="text/css">
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<head>
<title>Comparison -- Mobile Handset Manufacturers and Platforms, Q1 2013 and Q1 2013</title>
<link href="http://nvd3.org/src/nv.d3.css" rel="stylesheet">
<link href="http://nvd3.org/css/common.css" rel="stylesheet">
<link href="http://nvd3.org/css/syntax.css" rel="stylesheet">
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
@ESeufert
ESeufert / psuedo_code_bayesian_bandit.cpp
Last active August 29, 2015 13:56
Psuedo code for a Bayesian Bandit implementation. Bandit is a class.
epsilon = .1;
n_trials = 1000;
counter = 0;
function test() {
//pick a random number between 1 and 10, inclusive
random_number = rand(1, 10);
//if the random number is within the epsilon percentage
if (random_number <= bandit.epsilon * 10) {
//simply picks a bandit at random
<html>
<script src="http://d3js.org/d3.v2.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<h1>A D3.js Dashboard</h1>
<div id="metrics"></div>
</html>
var data = [];
// this is our data array
var startingDate = new Date(2012, 8, 18);
// this is a date object
for (var i = 0; i < 10; i++) { // loop 10 times to create 10 data objects
var tmpObj = {};
function getMaxObjectValue(this_array, element) {
var values = [];
for (var i = 0; i < this_array.length; i++) {
values.push(Math.ceil(parseFloat(this_array[i][""+element])));
}
values.sort(function(a,b){return a-b});
return values[values.length-1];