Skip to content

Instantly share code, notes, and snippets.

View enjalot's full-sized avatar

Ian Johnson enjalot

View GitHub Profile
@enjalot
enjalot / encodingTest.cpp
Created April 22, 2011 18:42 — forked from mathnathan/encodingTest.cpp
Video Networking
# include "highgui.h"
# include "cv.h"
# include <stdio.h>
# include <vector>
# include <string>
///blah
using namespace cv;
@enjalot
enjalot / index.html
Created October 1, 2011 20:25 — forked from ZJONSSON/index.html
Using data() enter and exit in D3
<!DOCTYPE html>
<html>
<head></head>
<body></body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript">
// Define the SVG domain in a viewbox to get automatic resize to
// window. This is a good alternative to d3.scale for simple stuff
svg=d3.select("body")
var r = 480,
format = d3.format(",d"),
fill = d3.scale.category20c();
var keeper;
var bubble = d3.layout.pack()
.sort(null)
.size([r, r]);
@enjalot
enjalot / index.html
Created October 24, 2011 23:21 — forked from ZJONSSON/index.html
D3 - using SVG Bounding Box to get the "automatic padding"
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<style>
path { fill:none;stroke:black}
</style>
<head>.
<body>
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
@enjalot
enjalot / index.html
Created December 5, 2011 05:01 — forked from mbostock/.block
Square Circle Spiral Illusion II
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
body {
background: #888;
}
@enjalot
enjalot / index.html
Created December 11, 2011 02:58 — forked from mbostock/.block
d3.js sin waves
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
body {
background: #333;
}
@enjalot
enjalot / gist:1821600
Created February 13, 2012 23:58 — forked from erikhazzard/gist:1821595
getbbox cs getcomputedlength
<html>
<meta charset='utf-8' />
<head>
</head>
<body>
<svg>
<text id="text_node" y="1em">
<tspan>You</tspan>
<tspan dx='.25em'>shall</tspan>
<tspan dx='.25em'>not</tspan>
@enjalot
enjalot / index.html
Created February 14, 2012 18:58 — forked from erikhazzard/index.html
d3 tspan append
<html>
<meta charset='utf-8' />
<head>
</head>
<body>
<svg>
<text id='text_node' y="20px" text-anchor="start" opacity="1">
<tspan>You</tspan>
<tspan dx='.5em'>shall</tspan>
<tspan dx='.5em' dy='.9em'>not</tspan>
@enjalot
enjalot / boid.js
Created March 30, 2012 23:29 — forked from enjalot/boid.js
spermboids
// Boid flocking based on http://harry.me/2011/02/17/neat-algorithms---flocking
var boid = (function() {
function boid() {
var position = [0, 0],
velocity = [0, 0],
w = 960,
h = 500,
gravityCenter = null,
gravityMultiplier = 1,
neighborRadius = 50,