Crystal ball forum software
-
A screenshot from forum software that apparently can predict future replies to your messages:
What actually happened is that I hit the back button in my browser and then opened the alerts panel. It’s slightly surprising, but not all that much, that to calculate when these events happened, it seems to use a time it has stored earlier rather than the system’s current time. What I find more surprising is that whoever wrote the code apparently took under consideration that the timestamp on a message might be in the future.
There may be a valid reason for that, but the only ones I can think of are somewhat convoluted scenarios.
-
@gurth said in Crystal ball forum software:
There may be a valid reason for that, but the only ones I can think of are somewhat convoluted scenarios.
Probably just a generic relative time library. "The scheduled livestream starts in 18 minutes"
-
@lb_ That makes sense. I suppose I’m TRWTF as it never occurred to me that someone wouldn’t write that sort of thing themselves.
-
@gurth You probably left pad your strings by hand, too, you barbarian.
-
@boomzilla said in Crystal ball forum software:
@gurth You probably left pad your strings by hand, too, you barbarian.
I do!
<?php echo str_pad($_GET['string'], $_GET['pad'], ' ',STR_PAD_LEFT); ?>
let str = 'Pad This!'; $.get('/leftpad', {string: str, pad: 4}, (padded) => { str = padded; });
Filed under: Obviously not actual code, Purchase leftpad_real for only $50 to get error checking!
-
@boomzilla said in Crystal ball forum software:
@gurth You probably left pad your strings by hand, too, you barbarian.
Does Javascript have a built-in function for that? I don’t remember ever needing it in that, but if not, then yeah, I’d probably do.
Thing is, I rarely use Javascript, and when I do it’s for pretty simple things, so I have no need for libraries => it didn’t really occur to me that people would use libraries for Javascript.
-
@Gurth said in Crystal ball forum software:
@boomzilla said in Crystal ball forum software:
@Gurth You probably left pad your strings by hand, too, you barbarian.
Does Javascript have a built-in function for that? I don’t remember ever needing it in that, but if not, then yeah, I’d probably do.
It's an npm library, not a built-in, it's called left-pad, and apparently it broke a whole bunch of websites when the developer deleted it over a naming controversy.
-
@gurth said in Crystal ball forum software:
Does Javascript have a built-in function for that?
To cut a long story short, lol-nope! Hilarity ensued when people found out that this trivial bit of software functionality ending up in a storm-in-a-teacup argument made a significant fraction of the Javascript ecosystem disappear.
-
@gurth said in Crystal ball forum software:
it didn’t really occur to me that people would use libraries for Javascript.
How beauteous mankind is! O brave new world,
That has such people in't!