Created by Christopher Manning
Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.
The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.
<?php | |
/* | |
* This scripts triggers the chart publication process. | |
* Usage: php publish-chart.php [CHART_ID] | |
*/ | |
define('ROOT_PATH', '../'); // relative path to your Datawrapper root | |
define('NO_SLIM', 1); | |
define('NO_SESSION', 1); |
Created by Christopher Manning
Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.
The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.
<?xml version="1.0" encoding="utf-8"?><gexf version="1.1" xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance"> | |
<graph defaultedgetype="undirected" mode="static"> | |
<attributes class="node" mode="static"> | |
<attribute id="0" title="country_rank" type="integer" /> | |
<attribute id="1" title="confederation" type="string" /> | |
<attribute id="2" title="team_count" type="integer" /> | |
<attribute id="3" title="country" type="string" /> | |
<attribute id="4" title="premier" type="boolean" /> | |
<attribute id="5" title="type" type="string" /> | |
<attribute id="6" title="rank" type="integer" /> |
for i in *.php ; do mv "$i" "`basename $i .php`.json" ; done |
#!/usr/bin/env node | |
var cmds = []; | |
if (process.argv.length < 3) { | |
console.log('You need to provide a commit message!'); | |
process.exit(-1); | |
} | |
cmds.push('git add -A'); | |
cmds.push('git add -u'); |
var page = require('webpage').create(); | |
page.viewportSize = { width: 1402*2, height: 800*2 }; | |
page.zoomFactor = 2; | |
page.open('http://localhost:1337/?forceRetina=1', function() { | |
var s = 420, z = 2; | |
page.clipRect = { | |
top: z * (630-s/2), | |
left: z * (1402 - s)/2, | |
width: z * s, | |
height: z * s |
(ls -t|head -n 5;ls)|sort|uniq -u|xargs rm -Rf |
// remove all images | |
$('table img').remove(); | |
// remove all reference links | |
$('table .reference').remove() | |
// convert all links to plain text | |
$('table a').each(function(index, el) { $(el).replaceWith($(el).html()) }); |
#!/usr/bin/env python2.7 | |
""" | |
No more trouble with comma-separated and quoted CSV files. | |
""" | |
import csv, sys | |
if len(sys.argv) != 3: print 'Usage:\ncsv2tsv fromfile.csv tofile.tsv' | |
file_in = sys.argv[1] | |
file_out = sys.argv[2] |
""" | |
implementation taken from | |
http://forum.worldwindcentral.com/showthread.php?t=20724 | |
algorithm expects a list of [lng,lat] pairs in degrees | |
""" | |
def haversine(x): | |
from math import cos | |
return ( 1.0 - cos(x) ) / 2.0 |