Skip to content

Instantly share code, notes, and snippets.

@balsama
balsama / gist:41dbbc146bd60402bdde9881c5c8a3a8
Created January 29, 2025 03:09
CSV writer helper method
/**
* Writes an array of arrays to a CSV file.
*
* @param string[] $headers
* The names of the table columns. Pass an empty array if you don't want any headers (e.g. if you're appending to
* an existing file.
* @param array[] $data
* Data to write. Each top-level array should contain an array the same length as the $header array.
* @param string $filename
* @param bool $append
Show a list of all years from 1900 to 2100 in which december 1st falls on a sunday
ChatGPT said:
ChatGPT
Here is a list of all the years from 1900 to 2100 in which December 1st falls on a Sunday:
csv
Copy code
year
1901
1904
@balsama
balsama / composer.json
Created October 13, 2023 17:27
Example `acquia_cms_community` `composer.json` generated by acms:build
{
"name": "acquia/drupal-recommended-project",
"description": "Acquia-compatible Drupal application based on the Drupal Recommended Project",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Acquia Engineering",
"homepage": "https://www.acquia.com",
"role": "Maintainer"
}
@balsama
balsama / boston311-trash-by-zip-and-year.json
Created September 11, 2023 00:09
Boston 311 reports about Trash by zip code by year
{
"2023": {
"02134": {
"year": "2023",
"zip": "02134",
"count": "433",
"zip_population": 18437,
"zip_area": 854.4388723219971,
"per_capita": 0.023485382654444865,
"per_area": 0.5067653333974522,
@balsama
balsama / uhub-articles-per-day.csv
Created August 10, 2023 03:11
Number of articles published on universalhub.com per day
date count
2020-11-28 3
2020-11-29 4
2020-11-30 6
2020-12-01 10
2020-12-02 9
2020-12-03 11
2020-12-04 5
2020-12-05 8
2020-12-06 6
@balsama
balsama / rangeConverter.php
Created June 9, 2022 14:11
Function to convert a value in a range to an equivalent value in a different range.
<?php
function rangeConverter(
int $input,
int $inputRangeMin,
int $inputRangeMax,
int $outputRangeMin = 0,
int $outputRangeMax = 100
) :int
{
@balsama
balsama / northEndWalkTimeToFruit.json
Created June 3, 2022 06:56
Walk time to nearest store that sells fruit for every address in the north end
{
"2 Atlantic Ave 02110": {
"timeToClosestPlace": 151,
"closestPlace": "golden goose",
"latlong": "42.364078674443,-71.050740588314",
"parcelId": "0303030010"
},
"206-214 Atlantic Ave 02110": {
"timeToClosestPlace": 426,
"closestPlace": "golden goose",
@balsama
balsama / NorthEndBostonAddresses.txt
Last active June 3, 2022 04:34
Unique addresses (no unit numbers) in City of Boston Ward Precincts 0301, 0302, 0303, and 0304 - roughly the North End.
2 Atlantic Ave 02110
206-214 Atlantic Ave 02110
28-32 Atlantic Ave 02110
45 Lewis Whf 02110
34-38 Atlantic Ave 02110
45-63 Atlantic Ave 02110
63 Atlantic Ave 02110
65-69 Atlantic Ave 02110
79-85 Atlantic Ave 02109
84 Atlantic Ave 02110
@balsama
balsama / stopwords.txt
Created December 22, 2021 04:06
STOPWORDS (excluded words) for generating Boston Vax Mandate 311 requests wordcloud
# standard
a
able
about
across
after
all
almost
also
am
@balsama
balsama / 311-vax-mandate-requests.txt
Last active December 22, 2021 04:01
Boston 311 requests containing the word vaccine (and its derivatives), vax, shot, and jab the day Michelle Wu announced the vaccine mandate for city employees and establishments.
please tell the mayor i will not do business in the city until the vaccine mandate is lifted.
can anybody tell me what makes the mayor supposedly running the city think she can make up laws or regulations that interfere with my rights. i am a person of colora us citizena us veteran elderly but , maybe that does not matter, maybe i have to be an "illegal" to get everything "free" and not worry about laws and vaccine mandate. are we now under communist rule with this person of color mayor???time to stand up and say "no"
i wont get vaccinated until we have a free pizza party
my body my choice! i'm a vaccinated person and still think this is absolutely asinine! michelle wu we are all against you
please note my report. i am a lifelong boston resident and i am completely opposed to the mayor's mandates. i've emailed the mayor twice as well as city councilors. guess what? no response. i will not show "papers" to dine out or bring my kids to the library. we are in charge of the government, not the other way around.