Skip to content

Instantly share code, notes, and snippets.

@idibidiart
idibidiart / CREDITS
Created July 30, 2012 22:24 — forked from GerHobbelt/.gitignore
d3.js: force layout; click to group/bundle nodes
Code derived from the d3.js 'force' example:
The miserables.json file contains the weighted network of coappearances of
characters in Victor Hugo's novel /Les Miserables/. Nodes represent characters
as indicated by the labels, and edges connect any pair of characters that
appear in the same chapter of the book. The values on the edges are the number
of such coappearances. The data on coappearances were taken from D. E. Knuth,
"The Stanford GraphBase: A Platform for Combinatorial Computing",
Addison-Wesley, Reading, MA (1993).
@idibidiart
idibidiart / delimited.js
Created August 8, 2012 01:27 — forked from gka/delimited.js
Extended CSV Parser for Miso.Dataset
(function(global, _) {
var Miso = (global.Miso || (global.Miso = {}));
/**
* Smart delimited data parser.
* - Handles CSV and other delimited data.
* - Includes auto-guessing of delimiter character if delimiter is set to "auto"
* Parameters:
* options
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.graticule {
fill: none;
stroke: #777;
}
.boundary {
@idibidiart
idibidiart / README.md
Last active December 19, 2015 10:49 — forked from tnightingale/README.md

This hexbin map shows the proximity of earthquakes (magnitude 3.0 or greater) in the Canterbury region of New Zealand during the month of September, 2010.

The map is created using Leaflet. The hexbin layer is a custom Leaflet layer which uses d3js to generate a svg hexbin overlay. The source for the custom leaflet layer is viewable here.

Earthquake data sourced from GeoNet.

<!DOCTYPE html>
<meta charset="utf-8">
<style>
.graticule {
fill: none;
stroke: #777;
}
.boundary {
@idibidiart
idibidiart / 158-brown.png
Last active December 20, 2015 00:49
Crystal Clear PNG Maps
158-brown.png
@idibidiart
idibidiart / README.md
Last active December 20, 2015 01:09 — forked from mourner/README.md

This is a D3.js Heatmap example showing how the highest sun position of the day (which directly correlates with average temperature) changes over the year depending on the latitude of the place. The actual temperature chart would be shifted to the right a bit beacuse of thermal lag.

The data for the chart is calculated using SunCalc.

// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
# For each day, find the appropriate Poisson Parameter and use it to calculate the likelihood of the actual view count
# Likelihood = P(D|H)
Calc.Likelihood <- function(changes, poissons, stats, periods) {
likelihood <- 0
for (day in 1:nrow(stats)) {
proceed <- FALSE
period <- 1
while (!proceed) {
if (day < changes[period]) {