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
// MyType is a generic that we can pass different types when calling handleAsyncTask() | |
const handleAsyncTask = async function<MyType> (asyncFn: () => Promise<MyType | string>) : Promise<[boolean, MyType | undefined]> { | |
const result = await asyncFn(); | |
if (typeof result === 'string') { | |
return [true, undefined]; | |
} | |
return [false, result]; | |
} |
Loading
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
function toTitleCase(string) { | |
const convertTitleCase = (str) => `${str.charAt(0)}${str.toLowerCase().slice(1)}` | |
const reservedWords = new Set(["a", "an", "at", "in"]); | |
return string | |
.split(" ") | |
.map((s) => { | |
if (reservedWords.has(s)) { | |
return s.toLowerCase(); | |
} | |
return convertTitleCase(s); |
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
#!/bin/bash | |
set -e | |
# dependencies: | |
# - youtube-dl: https://ytdl-org.github.io/youtube-dl/ | |
# - ffmpeg: https://ffmpeg.org/ | |
# make sure youtube-dl dep exists | |
if ! command -v youtube-dl &> /dev/null | |
then |
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
// Code Credit: @kkatzen, @aaronsn | |
// https://github.com/SatcherInstitute/health-equity-tracker/blob/master/frontend/src/utils/madlib/Fips.ts | |
export const USA_DISPLAY_NAME = "the United States"; | |
// Fake FIPS code used to represent totals in USA for convenience | |
export const USA_FIPS = "00"; | |
class Fips { | |
code: string; |
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
// In Chrome devtools, create live expressions for each of these code blocks | |
// https://developers.google.com/web/tools/chrome-devtools/console/live-expressions | |
// Now when you visit a page, no more annoying thing that will bother you! | |
// The annoying thing contains this text | |
const textToSearchFor = "foo" | |
// Filtering by searching for the above text here but you could filter other ways too | |
function filterFn(node) { | |
return node.textContent.includes(textToSearchFor); |
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
DROP TABLE IF EXISTS nyc_421a; | |
CREATE TABLE nyc_421a ( | |
years numeric, | |
borough_name varchar, | |
borough numeric, | |
neighborhood varchar, | |
building_class_category varchar, | |
tax_class_at_present varchar, | |
block numeric, |
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
#!/usr/bin/env bash | |
URI="https://services1.arcgis.com/sTaVXkn06Nqew9yU/ArcGIS/rest/services/Political_Boundaries_Feb2016/FeatureServer/1/query?&outfields=*&f=geojson&where=objectid%20is%20not%20null" | |
ogr2ogr -f GeoJSON ca_assembly_districts.json $URI OGRGeoJSON |
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
license: mit |
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
license: mit |
NewerOlder