Skip to content

Instantly share code, notes, and snippets.

View jacekd's full-sized avatar

Jacek Dominiak jacekd

View GitHub Profile
@jacekd
jacekd / README.md
Last active February 17, 2018 21:46 — forked from mbostock/.block

Say your dataset is an array of numbers, and includes both positive and negative values. Use two scales to construct the bar chart: a quantitative scale (such as a [linear scale][1]) to compute the bar positions along the x-axis, and an [ordinal scale][2] with rangeBands to compute the bar positions along the y-axis.

For the quantitative scale, compute the data domain (the minimum and maximum value) using [d3.extent][3]:

var x = d3.scale.linear()
    .domain(d3.extent(data, function(d) { return d.value; }))
    .range([0, width]);

[Nicing][4] the scale will extend the extent slightly to the nearest round numbers. If you want the zero-value to be centered in the middle of the canvas, take the greater of the minimum and maximum value by magnitude, or simply hard-code the desired domain.

@jacekd
jacekd / php54_php53_pear_macports.markdown
Created September 20, 2012 07:15 — forked from raphaelstolt/php54_php53_pear_macports.markdown
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules