Skip to content

Instantly share code, notes, and snippets.

@kerryrodden
kerryrodden / .block
Last active August 4, 2024 14:51
Sequences sunburst
license: apache-2.0
@kerryrodden
kerryrodden / README.md
Last active January 18, 2021 11:05
Zoomable sunburst with updating data

I combined Mike Bostock's Zoomable Sunburst and Sunburst Partition examples, so that I could have both zooming and updating the underlying data (between count and size, in this case). A simple combination of the examples does not work; you have to edit the arcTween function used for updating the data, so that when it redraws the partition layout, it takes account of the current zoom level by adjusting the domain of the x scale.

Click on any arc to zoom in, and click on the center circle to zoom out. Use the Size/Count radio buttons to update the data.

@kerryrodden
kerryrodden / LICENSE
Last active August 26, 2016 17:40
Sequences icicle
Copyright 2013 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@kerryrodden
kerryrodden / .block
Last active October 4, 2016 04:34
Sequences sunburst: unconf badge
license: apache-2.0
@kerryrodden
kerryrodden / .block
Last active March 1, 2024 18:46
Sequences sunburst (d3 v4)
license: apache-2.0
@kerryrodden
kerryrodden / .block
Last active January 22, 2017 23:55
Ticked off
license: apache-2.0
@kerryrodden
kerryrodden / .block
Last active February 20, 2019 14:47
Dynamic labeling over time
license: mit
@kerryrodden
kerryrodden / index.html
Last active June 6, 2021 06:09
Basic Tic-Tac-Toe in SVG
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Tic Tac Toe</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>

What this code does and why

This code makes a "poem" via choosing lines at random from a book of phrases - in particular, it uses "Fifteen Thousand Useful Phrases" by Grenville Kleiser, which it downloads from Project Gutenberg.

Inspired by other computer-generated short texts, like Allison Parrish's Twitter bots, I was curious whether I could generate some poetry that seemed vaguely plausible, purely by using a random approach - without having to do any natural language processing or machine learning. To do that I needed a text to choose lines from, where the individual lines were already readable English, and would have a reasonable chance of making some sense when rearranged at random.

Interesting outputs

Here are a few example outputs that I thought could pass as human-written poetry (not necessarily good poetry):

@kerryrodden
kerryrodden / README.md
Created February 10, 2019 02:51
p5.js sketch that uses clmtrackr to capture eye position and draw trails representing that over time

p5.js sketch that finds eye positions from the webcam and draws a representation of their movement, with random colors for the irises.

Click on the canvas to save an image; press a key to clear the canvas.

This sketch was very helpful in getting started with clmtrackr 🙏