Skip to content

Instantly share code, notes, and snippets.

View typeoneerror's full-sized avatar
🤠
iOS, Capacitor, Ember, Vue, Rails

Benjamin Borowski typeoneerror

🤠
iOS, Capacitor, Ember, Vue, Rails
View GitHub Profile
View working-on.js
lets(
/* Find all unfinished tasks */
tasks, prop("Tasks").filter(current.prop("Status") != "Done"),
/* Find all the people assigned to those tasks */
people,
tasks
.map(current.prop("Assignee"))
/**
* Because Assignee is a Person property, it's a list,
@typeoneerror
typeoneerror / next-action-notion.js
Created September 20, 2023 16:09
Next Action in a Project
View next-action-notion.js
lets(
/* Store unfinished actions */
actions, prop("Actions").filter(!["Done", "Archive"].includes(current.prop("Status"))),
/* Sort by timestamp of task and store with id */
actionId,
actions
.map(formatDate(current.prop("Date"), "X") + "-" + current.id())
.sort()
.first()
@typeoneerror
typeoneerror / monthly-median.js
Created September 15, 2023 21:38
Calculating median score through two databases
View monthly-median.js
lets(
values, prop("Agenda(s)").map(current.prop("Journal Entries").map(current.prop("Readiness"))).flat().sort(),
mid, (values.length() / 2).floor(),
value, values.length() % 2 == 0 ? (values.at(mid) + values.at(mid - 1)) / 2 : values.at(mid),
value
)
@typeoneerror
typeoneerror / average.js
Last active September 15, 2023 21:31
Pseudo Notion rollup to calc mean
View average.js
lets(
values, prop("Journal Entries").map(current.prop("Readiness")).filter(!current.empty()),
values.sum() / values.length()
)
@typeoneerror
typeoneerror / days-left.js
Last active September 16, 2023 15:48
Days left in Notion
View days-left.js
lets(
nowVal, now(),
/* We need now as just a date with no time */
nowDate, nowVal.formatDate("YYYY-MM-DD").parseDate(),
dueDate, prop("Due Date").formatDate("YYYY-MM-DD").parseDate(),
/* Days between now and the due date */
days, dateBetween(dueDate, nowDate, "days"),
@typeoneerror
typeoneerror / next-action.js
Created September 14, 2023 19:48
Display next incomplete task in Notion
View next-action.js
lets(
/* Store unfinished actions */
actions, prop("Actions").filter(current.prop("Status") != "Done"),
/* Sort by timestamp of task and store with id */
actionId,
actions
.map(formatDate(current.prop("Date"), "X") + "-" + current.id())
.sort()
.first()
View next-task.js
lets(
/* Store unfinished tasks */
tasks, prop("Tasks").filter(current.prop("Status") != "Done"),
/* Sort by timestamp of task and store with id */
task,
tasks
.map(formatDate(current.prop("Date"), "X") + "-" + current.id())
.sort()
.first(),
@typeoneerror
typeoneerror / relation-by-value.js
Last active September 7, 2023 18:17
Sort a Notion relation by value with highlights
View relation-by-value.js
prop("Videos")
.map(current.prop("Views"))
.sort()
.reverse()
.map(
lets(
views,
current,
prop("Videos").find(current.prop("Views") == views)
)
View notion-update-icons.js
const { notion, yargs } = require('../../shared');
const { fetchAllPages, performWithAll } = require('../../shared/fetch-pages');
const databaseId = 'e6a07b67d28a432fbd9029f18f3a27b8';
async function editPage(page) {
const params = {
page_id: page.id,
icon: {
type: 'emoji',
@typeoneerror
typeoneerror / essay-01.md
Last active July 26, 2021 15:15
#ship30for30 — @typeoneerror
View essay-01.md

(1) First Day on Duty

Today is for firsts

My first #ship30for30 essay. It's also my first day on "duty" as an alternate lieutenant at the Halfmoon Bay Volunteer Fire Department. I'll spend the week on-call 24/7—ready for response—emergency and non-emergency.

I started the morning helping EMS with a stage 4 cancer patient. Car 1 (my duty designation and truck) is parked in the driveway, prepared to respond when I receive a page.

And, to be perfectly honest, today I feel more prepared to lead an interior attack on a burning structure than to write a 250 word essay. But then, I didn't get to where I am as a volunteer firefighter by avoiding scary unknowns.