Skip to content

Instantly share code, notes, and snippets.

View clhenrick's full-sized avatar

Chris Henrick clhenrick

View GitHub Profile
@vijithassar
vijithassar / README.md
Last active October 2, 2019 16:45
Selective Force Positioning

Overview

Force-directed positioning based on a physics simulation can help with graph readability because it minimizes node occlusion, but it comes at the expense of precision, because both the X axis and the Y axis are compromised in favor of the simulation. As an alternative, we can position the points in some other fashion, then selectively apply force positioning to declutter the layout in specific regions when the user shifts attention toward them, such as with a mouseover.

This project is written in a heavily annotated style called literate programming. The code blocks from this Markdown document are being executed as JavaScript by lit-web.

Implementation

Setup

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 23, 2025 17:13
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@benelsen
benelsen / proj.rb
Last active May 16, 2017 20:41
Winkel-Tripel with GDAL2

Requires gdal2:

brew install osgeo/osgeo4mac/gdal2
export PATH="/usr/local/opt/gdal2/bin:$PATH" # or just use /usr/local/opt/gdal2/bin/gdalwarp

And a build of bleeding-edge version of proj:

brew reinstall proj.rb --HEAD
@mbostock
mbostock / .block
Last active January 16, 2020 12:46
GeoTIFF Contours
license: gpl-3.0
height: 481
redirect: https://observablehq.com/@d3/geotiff-contours
@johan
johan / Makefile
Created January 24, 2017 06:15
Makefile of the steps in Mike Bostock's command-line cartography tutorial, parts 1-4 https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c
# request one at http://api.census.gov/data/key_signup.html and paste it below
CENSUS_API_KEY=YOUR_CODE_HERE
# a factor 1609.34 squared
SQ_M_TO_SQ_MI=2589975.2356
#prereqs:
# npm install -g shapefile # 0.6.1
# npm install -g d3-geo-projection # 1.2.1
# npm install -g ndjson-cli # 0.3.0
@mbostock
mbostock / .block
Last active April 8, 2023 19:39
Versor Dragging
license: gpl-3.0
height: 600
border: no
redirect: https://observablehq.com/@d3/d3-versor-dragging
@jsanz
jsanz / README.md
Last active February 10, 2017 21:53
CARTO: Aggregating data on SQL and infowindows

CARTO: Aggregating data on SQL and infowindows

Example on how to aggregate data using spatial SQL and then show the also attributes on CARTO BUILDER infowindow.

Based on a sample dataset with images I will first reduce the geographical precission so they collide into a grid. After that using the json_agg function we join the urls into a single field along with the counts.

WITH data as (
@jsanz
jsanz / README.md
Last active February 10, 2017 22:01
JavaScritpt: bind event to custom infowindow visibility change in carto.js

On this simple carto.js example we add a custom infowindow using Mustache and bind to its model an event when the change:visibility property changes.

Open the console for the Hi! and Bye! messages when showing and closing an infowindow.

@veltman
veltman / README.md
Created October 10, 2016 16:08
Geosupport w/ JS and node-ffi

Geocoding 10,000 addresses a second with NYC's Geosupport library and Node FFI

Following on Chris Whong's excellent writeup of how to make calls directly to NYC's Geosupport client and this first attempt at generalizing it, here's a way that let me geocode about 10,000 addresses a second on Ubuntu using Node FFI.

Note: this assumes Ubuntu - other Linux is probably fine but may need adjustments.

First, install the basics:

# Update, install Node and unzip (if needed)