Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🏠

Davo Galavotti davo

🏠
View GitHub Profile

A demonstration of how to calculate the areas of Voronoi regions clipped by geographic features using D3.

[D3’s implementation](Sutherland–Hodgman algorithm) of the Sutherland–Hodgman algorithm only works for convex clip polygons, but we exploit the fact that Voronoi regions are guaranteed to be convex, and use each Voronoi region as a clip polygon, with the projected geographic boundary as a subject polygon.

In response to a question by Gonzalo Bellver.

@davo
davo / README.md
Last active August 29, 2015 14:01 — forked from jasondavies/README.md
Voronoi CABA

A demonstration of how to calculate the areas of Voronoi regions clipped by geographic features using D3.

[D3’s implementation](Sutherland–Hodgman algorithm) of the Sutherland–Hodgman algorithm only works for convex clip polygons, but we exploit the fact that Voronoi regions are guaranteed to be convex, and use each Voronoi region as a clip polygon, with the projected geographic boundary as a subject polygon.

In response to a question by Gonzalo Bellver.

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@davo
davo / README.md
Created August 7, 2014 17:48 — forked from madelfio/README.md

Shows multiple overlaid Voronoi diagrams, given multiple point sets.

@davo
davo / README.md
Last active August 29, 2015 14:14 — forked from mbostock/.block
  1. If you haven’t already: brew install ffmpeg gifsicle imagemagick.
  2. Open QuickTime Player.
  3. File > New Screen Recording.
  4. Record.
  5. Save as recording.mov.
  6. mkdir frames
  7. ffmpeg -i recording.mov -r 24 recording-%03d.png
  8. convert recording-001.png palette.gif
  9. convert -dither none -remap palette.gif recording-*.png recording-uncompressed.gif
  10. gifsicle --optimize=3 --delay=4 &lt; recording-uncompressed.gif &gt; recording.gif
@davo
davo / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Build Your Own Graph!

Click to add nodes! Nodes near the cursor will be linked to the new node.

D3's force layout uses the Barnes–Hut approximation to compute repulsive charge forces between all nodes efficiently. Links are implemented as geometric constraints on top of position Verlet integration, offering greater stability. A virtual spring between each node and the center of the chart prevents nodes from drifting into space.

@davo
davo / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Multi-Foci Force Layout

Click to perturb or drag the nodes!

This example demonstrates the flexibility of D3's force layout. By using position Verlet integration, it is easy to add custom forces to a layout. In this example, the nodes are clustered around four foci using additional forces: the odd nodes are pushed down, the even nodes are pushed up, and a similar bisecting force is applied laterally. These custom forces are based purely on the index of the node, but they could just as easily be derived from properties of data!

@davo
davo / index.html
Last active August 29, 2015 14:25 — forked from nbremer/README.md
Gooey Effect - Line
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/ >
<title>Gooey effect - Line</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
@davo
davo / index.html
Last active August 29, 2015 14:26 — forked from mbostock/.block
Force-Directed Graph with Mouseover
<!DOCTYPE html>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style>
.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
}
@davo
davo / README.md
Last active August 29, 2015 14:27 — forked from jazzido/README.md
Diferencia porcentual votos positivos al FPV entre PASO 2011 y 2015 — Por provincia