This comes from the “I Did Not Expect to Spend Time Code Fixing This Tiny Thing But is It Ever Rewarding When a Hunch Pans Out” department.
I kind of blame/credit my good friend Roland Tanglao (subscribe to his blog, something I had lapsed on doing, bad dog!). I’ve known Roland since the early early Northern Voice days, and we always connected on being camera geeks who love posting to flickr.
I like teasing Roland a little bit as he seems to love his angled view aka tilt photos, always be tilting Roland. And he posts in great volume- that’s well over 230,000 photos in one of his flickr accounts.
So when I saw an angle in one of my own photos yesterday, rather than making it level as I normally do, I tilted it Roland’s way.
Being good natured, he replied back in earnest to one of my tweets today praising flickr
All of this led me back to an ongoing bet, back in 2018, he wagered that flickr would die by a certain date in April, and we would know when the API went out. I wagered that it would be still running.
The stakes were high, the winner gets a free lunch paid for by the loser at Roland’s favorite eatery in Vancouver, the Boss.
The thing is, now that it’s three years after, it just has zeroes (more sophisticated libraries offer an end message). I was kind of clever with a background image of the famous flickr Bad Panda and my own photo of Roland (when we once really ate at The Boss).
I made a bet with myself, how fast could I tweak the simplyCountdown.js code to count how much time has passed since this date? I saw pretty quickly where it checks how much time is left between now and some date in the future. If this difference is 0, well, game over.
So here was my quick quess, the check point for everything is the value of
secondsLeft being the difference from the
targetDate when er are counting down to), and the current time
secondsLeft = (targetDate - nowUtc.getTime()) / 1000;
My hunch was to change the timer from countdown to to countup from, I just needed to change the math in both lines to
secondsLeft = (nowUtc.getTime() - targetDate) / 1000;
And thus, it works! The counter will now keep going upward! See it just go and go and go at https://pechaflickr.net/bet/
I might have saved time if I had checked the newer version of the countdown script, it now offers a countup option.
But how less satisfying that is than just figuring it out myself!
Yes, this is how Alan’s day sometimes gets sidetracked, but if it’s the name of giving an fun elbow jab to a friend like Roland AND I can score a small technical win, it all is worth it.
Now, take bets what the counter will read by the time I actually get to collect my lunch at the Boss. Not soon enough, Roland! We will celebrate with a tilted photo or 20,000.
Featured Image: Who needs other photos? I had my own photo of a countdown clock spotted on the campus of Tec de Monterey in Guadalajara- it’s the amount of time left until a 30 year time capsule is to be opened.