This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rig example, in config.js | |
const path = line() | |
.curve(curveMonotoneX) | |
.x(d => x(d.date)) | |
.y(d => y(d.value)) | |
.defined(d => (d.value !== null) && (d.value !== -999)); | |
// d3 generic example, from: https://bl.ocks.org/EmbraceLife/b8dda609b87a3bab7e952769fd028f53 | |
var line = d3.line() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Force load raster as PNG (Safari will use JPG otherwise) to preserve transparency | |
map.addSource('noaa_map', { | |
type: 'raster', | |
tiles: [ | |
`https://api.mapbox.com/v4/cnndigital.7d5hl52y/{z}/{x}/{y}.png?access_token=${mapboxgl.accessToken}`, | |
], | |
}); | |
map.addLayer({ | |
id: 'raster-layer', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a second later send a confidence height ... just to be sure | |
setTimeout(() => { pymChild.sendHeight(); }, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clear tile storage to ensure latest data is shown | |
// (failure to do this could leave old data in browser for up to 12 hours) | |
mapboxgl.clearStorage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i infile.mp4 -vf "select=eq(n\,0)" -q:v 3 outfile.jpg | |
# from https://stackoverflow.com/questions/4425413/how-to-extract-the-1st-frame-and-restore-as-an-image-with-ffmpeg/4425466 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://css-tricks.com/snippets/css/prevent-superscripts-and-subscripts-from-affecting-line-height/ | |
sup, sub { | |
vertical-align: baseline; | |
position: relative; | |
top: -0.4em; | |
} | |
sub { | |
top: 0.4em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assumes multiple lines on a graph | |
// like: {id: 'category one', values: [ [0,0], [1,1] [2,2] ... ]} | |
// define circles as markers for the line to use | |
lines.append('defs') | |
.append('marker') | |
.attr('id', d => `v-dot-${d.id}`) | |
.attr('viewBox', [0, 0, 10, 10]) | |
.attr('refX', 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<title>Newmark Bark</title> | |
<meta name="description" content="latest news"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- import the webpage's stylesheet --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hpgraphic: | |
npx mapshaper -i ./src/data/latest-mercator.geojson ./src/data/states/us-state-innerlines.geojson combine-files \ | |
--rename-layers counties,lines \ | |
--style target=lines stroke='#a0a0a0' stroke-width=0.5 \ | |
-proj albersusa \ | |
-o target=counties,lines format=svg ./src/data/for_hp.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Source: https://gist.github.com/daichan4649/8877801 */ | |
/* and this blog post: https://www.labnol.org/code/20005-publish-json-google-spreadsheets */ | |
// Note: To use... | |
// - from your sheet, go to Tools > Script Editor | |
// - delete the code that's there | |
// - paste in this code | |
// - change the sheetId to match that of your sheet. You'll find it in the url between /d/ and /edit | |
// - click "run" and authorize the app | |
// - click "Deploy" |