💾 Archived View for text.adventuregameclub.com › tech › 2022-02-24-cruisin-grand.gmi captured on 2023-07-10 at 13:12:43. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Create a Remind Entry for Cruisin' Grand in Escondido

The code:

SET CGSTART evaltrig("Friday 1 April", today()-182)
SET CGEND evaltrig("30 Sept", CGSTART)
REM [CGSTART] *7 UNTIL [CGEND] CAL Cruisin' Grand

Cruisin' Grand

Cruisin' Grand is held on Fridays from April through September on Grand Avenue in Escondido. People park their fancy cars for you to see and the street is closed to all but foot-traffic. It's a nice event, and one I'd like to be reminded of, but not something I'd consider a scheduled appointment or anything.

I'm a little fuzzy on the exact start and end dates, but I think this was pretty close to their schedule before COVID hit. Now they probably start later than the first Friday in April and end before the last Friday in September.

Remind

Scheduling this in `remind` was harder than I expected. If you don't know about Remind, then you should take a look at it. It's a really powerful calendar application.

https://dianne.skoll.ca/projects/remind/

The CAL Command

Remind has a `CAL` command for listing reminders only when you generate calendars. This is perfect for something like Cruising Grand; it won't show up in your list of daily events, but if you print out a monthly calendar, or use wyrd, you'll see it there.

https://gitlab.com/wyrd-calendar/wyrd

The UNTIL Command

You can use the UNTIL Command to schedule multiple events from one date UNTIL another.

A reminder might be something like:

REM 2022-04-01 *7 UNTIL 2022-09-30 CAL Cruisin' Grand

This will create a CAL[endar] entry that starts on 2022-04-01 (which is a Friday) and repeats every seven days (*7) UNTIL 2022-09-30. But I wanted an entry where I didn't have to change the dates every year.

SATISFY 1

In remind, you can set the value of a variable with a pair of lines like this:

REM Friday 1 April SATISFY 1
SET CGSTART trigdate()

This has Remind search for a Friday on or after April 1. The SATISFY command means remind will keep searching until some condition is satisfied, but here the condition is '1', meaning 'true', or always satisfied. So Remind stops at the first Friday found. `trigdate()` returns the date it found, and we set the variable *CGSTART* to the value returned by `trigdate()`

This seems to be a pretty standard way of doing this sort of thing that appears in a lot of example code. So because this is the method I knew about, this is the method I used at first. It works, but it's hard to read, and I found a better way.

A Better, Simpler Way

That probably seems more complicated than it needs to be. There is a simpler way that we might use, and that's to use the (new?) `evaltrig()` function:

SET CGSTART evaltrig("Friday 1 April")
There's a good use for SATISFY. It lets you tell remind to keep looking until it finds a date that satisfies some condition. So you could tell remind to keep looking for Fridays until it satisfies the condition that the day number of that Friday equals thirteen. Now you've found the next Friday the 13th!

UNTIL

Once I had the start date set, I could easily find the end date with something like:

REM CGEND evaltrig("30 Sept")

FAIL

So now I could put these two together and enjoy the magic:

SET CGSTART evaltrig("Friday 1 April")
SET CGEND evaltrig("30 Sept")
REM [CGSTART] *7 UNTIL [CGEND] CAL Cruisin' Grand

But when I fired up wyrd to bask in my own glory, I found that "Cruisin' Grand" only showed up on April 1!

The Problem

The problem was that on the next Friday, April 8, remind searches for ("Friday 1 April") starting on April 8, and finds it in the next year. The CGSTART date changes to the next year and messes everything up.

Solution

Well, with most remind commands you can use a `SCANFROM` command to tell remind where to start looking from, but that doesn't work with `evaltrig()`. Luckily, `evaltrig()` *does* take the same sort of "start-from-here" date as an optional second argument. So I can do:

SET CGSTART evaltrig("Friday 1 April", "2022-04-01")

Ah, but now I have the same problem of having to update that date every year, so instead, I'll just tell remind to start searching six months ago:

SET CGSTART evaltrig("Friday 1 April", today()-182)

Success

Now I can put it all together:

SET CGSTART evaltrig("Friday 1 April", today()-182)
SET CGEND evaltrig("30 Sept", CGSTART)
REM [CGSTART] *7 UNTIL [CGEND] CAL Cruisin' Grand

Note that I start searching for September 30 starting with the CGSTART date, to make sure that it doesn't skip to finding September 30 of the next year on October 1.