Saving custom color palettes to a variable, then using them in a ggplot chart
saving the palette
palette <- c(‘#d2848c”, “#fa807s”, “#ee9a00”, “#e0ffff”)
| // from purpleair.com | |
| // original source: https://docs.google.com/document/d/15ijz94dXJ-YAZLi9iZ_RaBwrZ4KtYeCy08goGBwnbCU/edit# | |
| function aqiFromPM(pm) { | |
| if (isNaN(pm)) return "-"; | |
| if (pm == undefined) return "-"; | |
| if (pm < 0) return pm; | |
| if (pm > 1000) return "-"; | |
| /* |
| [ | |
| { | |
| "name": "Roslindale", | |
| "latlong": [-71.1245, 42.2913] | |
| }, | |
| { | |
| "name": "Jamaica Plain", | |
| "latlong": [-71.1202, 42.3098] | |
| }, | |
| { |
Saving custom color palettes to a variable, then using them in a ggplot chart
saving the palette
palette <- c(‘#d2848c”, “#fa807s”, “#ee9a00”, “#e0ffff”)
| select { | |
| display: inline-block; | |
| font-weight: 400; | |
| padding: .5rem 1.5rem .5rem .5rem; | |
| border: 1px solid rgb(175,175,175); | |
| box-shadow: 0 1px 0 1px rgba(0,0,0,.04); | |
| border-radius: .5em; | |
| -moz-appearance: none; | |
| -webkit-appearance: none; | |
| appearance: none; |
| import sys | |
| import os | |
| import re | |
| dir_path = os.path.dirname(os.path.realpath(__file__)) + '/' | |
| static_content_folder = 'static/custom/ai2html-output/' | |
| # script takes two arguments "input" and "output" and optional static content folder arg | |
| # .js extension is added to output |
lsof -iTCP -sTCP:LISTEN -n -P: See what is running on which portkill {portnumber}: Stop whatever is running on designated portmongod --dbpath {dir_path}: Specify where mongodb should start up the databasemongosh: Enter the mongodb shelluse {db_name}: Create a database by namedb.{collection_name}.insertMany({json_array}): Insert multiple records into a database collection| duplicate | Received | Employer | City/Town | Region | Layoff date(s) | Employees impacted | |
|---|---|---|---|---|---|---|---|
| False | 4/3/2026 | South Shore Elder Services | Braintree, MA | Southeast | 6/1/2026 - 6/30/2026 | 52 | |
| False | 3/30/2026 | Clover Fast Food, Inc. (Clover) | Cambridge, MA | Boston | 5/29/2026 | 182 | |
| False | 3/29/2026 | Walmart | Worcester, MA | Central | 5/29/2026 | 90 | |
| False | 3/25/2026 | Takeda Pharmaceuticals USA, Inc. (dba Takeda) | Cambridge, MA | Boston | 7/1/2026 - 12/31/2027 | 247 | |
| False | 3/25/2026 | Charles River Laboratories | Wilmington, MA | Boston | 4/24/2026 - 7/10/2026 | 71 | |
| False | 3/24/2026 | Revvity, Inc. | Boston, MA | Boston | 6/1/2026 - 3/31/2027 | 29 | |
| False | 3/24/2026 | Compass Group USA, Inc. (dba Chartwells) | Boston, MA | Boston | 5/27/2026 | 76 | |
| False | 3/18/2026 | WestRock Services, LLC (aka WestRock and Smurfit Westrock) | Wakefield, MA | Boston | 5/18/2026 | 91 | |
| False | 3/12/2026 | Boston Electrometallurgical Corporation (dba Boston Metal) | Woburn, MA | Boston | 4/21/2026 | 71 |