Skip to content

Instantly share code, notes, and snippets.

@tophtucker
tophtucker / README.md
Last active March 25, 2021 09:08
Wordwrap zigzag

hi

@tophtucker
tophtucker / README.md
Last active March 8, 2021 09:31
Continuous word wrap

Been meaning to try this for a long time! Inspired to go for it by Omar's recent work! I forget how to work with gists!

To-do:

  • Account for padding and such
  • “Snap” words to the next line where they fit whole
  • Wrap into different containers? Different directions?
  • Ultimate goal: diagonal accelerometer scroll 😈

Sample text is from Moby Dick, Chapter XCVI: The Try-Works

@tophtucker
tophtucker / README.md
Last active February 21, 2024 22:11
d3 color-legend example

In response to a question on Twitter by @everybody_kurts:

“Hi @mbostock, I was looking at your stacked area chart at https://observablehq.com/@d3/stacked-area-chart. At the end of the file, you import swatches from "@d3/color-legend". I tried finding this on npmjs but to no avail. Is this exclusive to @observablehq only?”

This shows how to use the swatches function from the @d3/color-legend notebook in a plain HTML page. The example data for the swatches (the color scale and margin) is copied from the @d3/stacked-area-chart notebook.

@tophtucker
tophtucker / BodoniXT.ttf
Last active November 4, 2022 18:27
Responsive Zara
@tophtucker
tophtucker / .DS_Store
Last active January 28, 2018 22:52
Hue rotation
@tophtucker
tophtucker / .DS_Store
Last active May 24, 2024 12:31
Measure text
@tophtucker
tophtucker / .DS_Store
Last active January 28, 2018 23:53
Bayes (WIP 2)
@tophtucker
tophtucker / README.md
Last active September 13, 2019 09:59
Viewport reflowing

Creates as many copies of the document as necessary to show the whole thing, like a sort of pagination. As you scroll, it spools and unspools into as many pages as it needs. So the whole document is kinda visible all at once, in slices.

Why’d I pick The Waste Land? Something with scattered images probably would’ve been better. Idk, sometimes I just get on a kick of using a certain text. Clearly I have very little editorial vision here.

It could be better generalized (so that e.g. there isn’t just a fixed number of pages allocated on load)... and I kinda want all the pages to be drifting around the space... fluttering, bumping. There are also obviously more pragmatic variants, like a dual-page reader that accommodates either page-turning or scrolling. Or a more deterministic layout where the remaining pages are presented in an orderly fashion so you get a better sense of how much you have left to read or w/e. Why would anyway want that anyway. Whyyyy am I doing thissssss————

Long ago, like years ago — wai

@tophtucker
tophtucker / README.md
Last active September 24, 2017 23:05
Bayes (WIP)

From a friend: “1. What's the probability of a HS athlete going pro? 2. Suppose we know a pro athlete. What's the probability she was a college athlete?”

So I was thinking about my favorite intuitive illustrations and explanations of conditional probability and Bayes' theorem, e.g.

I asked for help here, there's some good discussion: https://math.stackexchange.com/questions/2407913/is-it-possible-to-divide-a-square-into-four-parts-of-arbitrary-size-with-two-lin

To-do: