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
name: Build and Deploy a React application to GitHub-Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy-to-gh-pages: | |
runs-on: ubuntu-latest |
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
const rp = require('request-promise'); | |
const { to } = require('await-to-js'); | |
const crypto = require('crypto'); | |
const redisClient = require('./redis-client'); | |
/** | |
* Execute an API call | |
* @param {String} uri API URI | |
* @param {Number} ttl Expiration of cache in seconds | |
*/ |
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
COPY ( | |
SELECT JSON_AGG(f) FROM ( | |
SELECT s.stusps || '-' || cd.cd116fp AS id, ARRAY_AGG(z.zcta5ce10) AS zip_codes | |
FROM cb_2018_us_cd116_500k cd | |
INNER JOIN cb_2018_us_zcta510_500k z | |
ON ST_Intersects(cd.geom,z.geom) | |
JOIN cb_2018_us_state_500k s ON cd.statefp = s.statefp | |
GROUP BY s.stusps || '-' || cd.cd116fp | |
) f) | |
TO '/Users/christopherlanoue/Documents/congressional_zip_code_lookup.json'; |
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
import labella from 'labella'; | |
let points = []; | |
const force = new labella.Force() | |
.nodes(points.map((d) => new labella.Node(d.y, 15, d))) // 15 is label height/spacing | |
.compute(); | |
points = points.map((d) => { | |
const matchingNode = force.nodes().find((node) => node.data.id === d.id); | |
return { | |
...d, |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Remove Alaska (02), Hawaii (15), Puerto Rico (72), American Samoa (60), United States Virgin Islands (78), Guam (66), and Commonwealth of the Northern Mariana Islands (69) | |
filter 'FID != "02"' | |
// [filter] Retained 55 of 56 features | |
filter 'FID != "15"' | |
// [filter] Retained 54 of 55 features | |
filter 'FID != "72"' | |
// [filter] Retained 53 of 54 features | |
$ filter 'FID != "60"' | |
[filter] Retained 52 of 53 features |
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
# Retrieve data from https://water.usgs.gov/GIS/metadata/usgswrd/XML/places.xml#stdorder | |
# curl https://water.usgs.gov/GIS/dsdl/places.e00.gz | |
# put the data into "Web Mercator" projection | |
PRJ="EPSG:4326" | |
DB=gis_db | |
# The original files were coverages, so I have to know something about | |
# what I want to transfer. For example for this file I want only LAB | |
# ogrinfo places.e00 |
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
import React from 'react'; | |
import {area as d3_area, curveBasis} from 'd3-shape'; | |
const AreaChart = ({data, xScale, yScale, selectedItem, setSelectedItem, barWidth = 0}) => { | |
// Set up an area chart generator | |
const area = d3_area() | |
.curve(curveBasis) | |
.x(d => d.x) | |
.y0(d => d.y0) |
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
SELECT ROW_TO_JSON(fc) AS json_out FROM ( | |
SELECT 'FeatureCollection' AS type, | |
ARRAY_TO_JSON(ARRAY_AGG(f)) AS features | |
FROM ( | |
SELECT 'Feature' AS type, | |
ST_AsGeoJSON(c.geom)::json AS geometry, | |
ROW_TO_JSON(( | |
SELECT l FROM ( | |
SELECT r.radii, | |
r.synoptime, |