Skip to content

Instantly share code, notes, and snippets.

View garrettdashnelson's full-sized avatar
💭
Oh, you know, just typing on the computer

Garrett Dash Nelson garrettdashnelson

💭
Oh, you know, just typing on the computer
View GitHub Profile
javascript: (() => { let elements = ["tab-Red", "tab-Green", "tab-Blue", "tab-Orange"]; let n = 0; let doClick = function () { document.getElementById(elements[n]).click(); if (n == elements.length - 1) { n = 0; } else { n = n + 1; } }; setInterval(doClick, 5000); })();
DISTRICTID STFIPS CDFIPS STATE_ABBR NAME LAST_NAME PARTY GEO_ID
5600 56 00 WY Liz Cheney Cheney Republican 5001600US5600
5401 54 01 WV David B. McKinley McKinley Republican 5001600US5401
5402 54 02 WV Alexander X. Mooney Mooney Republican 5001600US5402
5403 54 03 WV Carol Miller Miller Republican 5001600US5403
5501 55 01 WI Bryan Steil Steil Republican 5001600US5501
5502 55 02 WI Mark Pocan Pocan Democrat 5001600US5502
5503 55 03 WI Ron Kind Kind Democrat 5001600US5503
5504 55 04 WI Gwen Moore Moore Democrat 5001600US5504
5505 55 05 WI Scott Fitzgerald Fitzgerald Republican 5001600US5505
@garrettdashnelson
garrettdashnelson / scrape_digicoll_search_results.py
Last active October 12, 2021 20:51
Scrape search results out of LMEC digital collections
import requests
import datetime
import csv
searchString = "https://collections.leventhalmap.org/search?f%5Bcollection_name_ssim%5D%5B%5D=American+Revolutionary+War-Era+Maps+%28Collection+of+Distinction%29"
fields = ["label_ssim","date_start_tsim","institution_name_ssim"]
complete = False
page = 1
{
"metadata": {
"author": "Garrett Dash Nelson",
"title": "Narrating maps and images with panel-truck",
"subtitle": "An interactive tool from the Leventhal Map & Education Center",
"publishedDate": "2021-02-12"
},
"sources": [
{
"id": "1",
{"metadata":{"title":"Let's try another one out","author":"Goober Garber","subtitle":"Does it work? We'll find out","datePublished":"Doomsday"},"scenes":[{"caption":{"text":"with a big zoomed out **map**!!","title":"Let's start here"},"extent":"fit","moreInfo":"https://collections.leventhalmap.org/search/commonwealth:hx11z575j","sceneSource":{"sourceType":"iiif","iiifManifest":{"manifest":"https://collections.leventhalmap.org/search/commonwealth:hx11z575j/manifest","sequence":0,"canvas":0,"image":0}}},{"caption":{"text":"we will zoom in on the caption"},"extent":[217.38666666666677,-1190.9066666666668,1424.3866666666668,-289.68],"moreInfo":"https://collections.leventhalmap.org/search/commonwealth:hx11z575j","sceneSource":{"sourceType":"iiif","iiifManifest":{"manifest":"https://collections.leventhalmap.org/search/commonwealth:hx11z575j/manifest","sequence":0,"canvas":0,"image":0}}},{"caption":{"text":"then on [Boston](https://boston.gov)"},"extent":[1376.1066666666666,-3395.6933333333336,3355.586666666667,-149
@garrettdashnelson
garrettdashnelson / test-screenplay.json
Last active January 4, 2021 16:48
test-screenplay.json
{
"metadata": {
"author": "Garrett Dash Nelson",
"title": "Narrating maps and images with panel-truck",
"subtitle": "An interactive tool from the Leventhal Map & Education Center",
"publishedDate": "2020-12-30"
},
"scenes": [
{
"sceneSource": {
import requests
from bs4 import BeautifulSoup
barcode = "39999059010775"
r = requests.get('https://collections.leventhalmap.org/search?page=1&per_page=100&q={}'.format(barcode))
htmlSource = BeautifulSoup(r.text, "html.parser")
for d in htmlSource.find_all("div", class_="document"):
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
height: 500px;
position: relative;
width: 960px;
}
@garrettdashnelson
garrettdashnelson / bending-lines.json
Created August 23, 2019 19:15
bending-lines.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{"nodes": [{"name": "Inner Hanover NH"}, {"name": "Groton-Ryegate-Peacham VT"}, {"name": "Rockingham VT"}, {"name": "Enfield NH"}, {"name": "Haverhill NH"}, {"name": "Danbury-Wilmot-Hill NH"}, {"name": "Hartford North of the White River VT"}, {"name": "Lebanon North of Route 4 NH"}, {"name": "Windsor VT"}, {"name": "Lebanon South of Route 4 NH"}, {"name": "Royalton VT"}, {"name": "Springfield Northeast VT"}, {"name": "Outer Hanover NH"}, {"name": "Norwich VT"}, {"name": "Piermont-Orford-Wentworth NH"}, {"name": "Weathersfield VT"}, {"name": "New London NH"}, {"name": "Hartland VT"}, {"name": "Randolph VT"}, {"name": "Newbury VT"}, {"name": "Chelsea-Vershire-Tunbridge-Strafford VT"}, {"name": "Walpole NH"}, {"name": "Bradford VT"}, {"name": "Unity-Acworth-Langdon NH"}, {"name": "Bellows Falls VT"}, {"name": "Charlestown NH"}, {"name": "Claremont Southwest NH"}, {"name": "Claremont Southeast NH"}, {"name": "Plainfield-Cornish NH"}, {"name": "Grantham-Croydon-Springfield NH"}, {"name": "Orange-Washington VT"}, {