Skip to content

Instantly share code, notes, and snippets.

View bclinkinbeard's full-sized avatar

Ben Clinkinbeard bclinkinbeard

View GitHub Profile
<foo>
<boo />
</foo>
@bclinkinbeard
bclinkinbeard / README.md
Created September 16, 2012 02:51 — forked from mbostock/.block
Letter Frequency

D3 2.10 adds support for optional outer padding with d3.scale.ordinal. This parameter allows you to control the outer padding (before the first bar and after the last bar) separately from the inner padding between bars. In this case, the inner padding is 10% and the outer padding is 20%.

var x = d3.scale.ordinal()
    .rangeRoundBands([0, width], .1, .2);
@bclinkinbeard
bclinkinbeard / README.md
Created September 16, 2012 02:54 — forked from mbostock/.block
Letter Frequency

D3 2.10 adds support for optional outer padding with d3.scale.ordinal. This parameter allows you to control the outer padding (before the first bar and after the last bar) separately from the inner padding between bars. In this case, the inner padding is 10% and the outer padding is 20%.

var x = d3.scale.ordinal()
    .rangeRoundBands([0, width], .1, .2);

The Scope class regulates lexical scoping within CoffeeScript. As you generate code, you create a tree of scopes in the same shape as the nested function bodies. Each scope knows about the variables declared within it, and has a reference to its parent enclosing scope. In this way, we know which variables are new and need to be declared with var, and which are shared with the outside.

Import the helpers we plan to use.

{extend, last} = require './helpers'

@bclinkinbeard
bclinkinbeard / gist:6445373
Last active December 22, 2015 08:29 — forked from ThomasBurleson/gist:6445197
CommonJS format
var supplant = require('utils/supplant');
function rhex(n) {
var s = '', j = 0;
for (; j < 4; j++) {
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
}
return s;
}
module.exports = function (path, opts) {
return function (err, src) {
if (!opts) opts = {}
if (!path) throw new Error('Path must be provided')
if (err) {
throw err
@bclinkinbeard
bclinkinbeard / README.md
Last active August 29, 2015 14:20 — forked from mbostock/.block

A dendrogram is a node-link diagram that places leaf nodes of the tree at the same depth. In this example, the classes (leaf nodes) are aligned on the right edge, with the packages (internal nodes) to the left. Data shows the Flare class hierarchy, courtesy Jeff Heer.

Compare to this radial layout. YO DAWG

@bclinkinbeard
bclinkinbeard / README.md
Last active August 29, 2015 14:22 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.

@bclinkinbeard
bclinkinbeard / chart.js
Last active August 29, 2015 14:22 — forked from mbostock/.block
var margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom,
d3 = window.d3
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.1)
var y = d3.scale.linear()
.range([height, 0])