Skip to content

Instantly share code, notes, and snippets.

View bwswedberg's full-sized avatar

Brian Swedberg bwswedberg

View GitHub Profile
@eykd
eykd / esv_ranges.py
Created February 24, 2011 14:14
Data structure defining the number of verses in every chapter of every book of the ESV bible.
# list of books, padded with None to be 1-indexed
# each book is a tuple with name of book, # of chapters, [number of verses in each chapter]
# the list with the number of verses per chapter is padded to make it 1-indexed
passage_data = [None,
('Genesis', 50, [None, 31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35,
46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26]),
('Exodus', 40, [None, 22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21,
43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38]),
('Leviticus', 27, [None, 17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34]),
('Numbers', 36, [None, 54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65,
@mbostock
mbostock / .block
Last active March 5, 2019 23:09
Zoomable Icicle
license: gpl-3.0
redirect: https://observablehq.com/@d3/zoomable-icicle
@mbostock
mbostock / .block
Last active March 29, 2023 23:39
Collapsible Indented Tree
license: gpl-3.0
redirect: https://observablehq.com/@d3/indented-tree
@mbostock
mbostock / .block
Last active June 25, 2024 17:36
Gradient Along Stroke
license: gpl-3.0
@cobyism
cobyism / gh-pages-deploy.md
Last active June 26, 2024 23:06
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@eweitnauer
eweitnauer / README.md
Created October 11, 2013 21:03
Quadtree 3

This example demonstrates how to take the size of objects into account when selecting objects efficiently with a quadtree. Selected objects are shown in red, visited but not selected objects are shown in yellow. The efficiency depends on the biggest width and biggest height among all object. It is assumed that all objects are rectangle-shaped.

Example series:

Based on Mike Bostock's quadtree example.

@mbostock
mbostock / .block
Last active March 19, 2024 07:45
Wrapping Long Labels
license: gpl-3.0
@armollica
armollica / .block
Last active May 2, 2019 08:22
HTML Annotation
height: 960
@armollica
armollica / .block
Last active May 31, 2018 23:14
Life on the Mississippi
height: 3000
@armollica
armollica / README.md
Last active December 13, 2023 12:29
Convert SVG to Canvas

Convert SVG to canvas on-the-fly.

This article from MDN explains the process: Drawing DOM object into a canvas. This works for any DOM object, not just SVG. Not sure if this is well supported by older browsers. Works on Chrome, Firefox and IE 10 for me. The bar chart is a fork of this block by Mike Bostock: Canvas Bar Chart.