#dev 2024-03-03
2024-03-03 UTC
[snarfed] joined the channel
burley and [Joe_Crawford] joined the channel
# [Joe_Crawford] https://regex101.com is incredibly convenient to use for a big pile of cases to check against. I have not played much with the BBEdit regex explorer thing. "Pattern Playground" they call it.
burley and bterry joined the channel
# Loqi A regular expression is a sequence of characters used to match, extract, and/or replace patterns in text https://indieweb.org/regex
# [Joe_Crawford] regex101 added in 2019! A fine page, that is.
angelo_ joined the channel
# [Al_Abut] Can I get some fresh eyes on the thing I’ve been working on? I’m catching up on all the different techniques/factors for making responsive images and made a little sandbox to test out:
# [Al_Abut] https://alabut.com/drafts/responsiveimages/
# [Al_Abut] Like don’t tweet it out or whatever, this is just for the indieweb fam until I write up a tutorial but I’d love to know if anyone can poke holes in this strategy.
# [Al_Abut] I’m taking a pause before I go down the rabbit hole of building a pipeline of assets that actually use it (applescript/automator/shortcuts to create image variations, MDX components to embed in markdown posts, etc)
# [Al_Abut] Oh and in case anyone’s wondering why I’d bother with all of that madness, here’s an animated GIF with a real world example: https://www.threads.net/@alabut/post/C3_Eo1xM-0R
bret and burley joined the channel
# box464 Hi! Just wanted to share, I added basic microformatting to this ActivityPub educational tool Terence Eden is building. Hoping anyone that picks it up to learn AP will also include microformats in applications they build later. 😃 https://gitlab.com/edent/activitypub-single-php-file and my spun up instance of it https://ape.box464.social
burley_ and jacky joined the channel
burley and [jeremycherfas] joined the channel
# [jeremycherfas] [Al_Abut] That demo is cool, although I wonder about the decision to crop the image for the smallest screens. Seems to be risky and does not convey the same idea, to me.
burley, geoffo, gRegor, oodani, Guest6, ttybitnik, jacky and superkuh joined the channel
# [Al_Abut] [jeremycherfas] thanks for checking it out. I wouldn’t crop the images automatically, that’s not clear from the demo. You’re right that it would be too risky - could cut off subjects or make it weird in other ways.
# [Al_Abut] The benefit of customizing images for mobile is that “normal” images (typically wide and made for desktop) look terrible. They come out microscopic because the wider you make an image, the shorter the height, so you end up with a postage stamp.
# [Al_Abut] (also just read your Seven Year Itch post, you’re hilarious)
burley, burley_ and jacky joined the channel
mahboubine, geoffo and [Tilley] joined the channel
# real_devastatia I have a question about the innards of Firefox. Why is it that styles in an external stylesheet can't be accessed by, e.g., document.getElementById('whatever').style.whatever ? I've implemented a jQuery-esque workaround by adding an Element.prototype.css() method, which sniffs window.getComputedStyle(), but I'm still curious.
jacky joined the channel
# [tantek] the element.style is for the style attribute. to access external stylesheets, use the stylesheets collection: https://developer.mozilla.org/en-US/docs/Web/API/Document/styleSheets
# real_devastatia Thanks! I figured it had something to do with style being an attribute. Is document.stylesheets preferable to querying window.getComputedStyle, or are there specific intended use cases for each?
# real_devastatia I find that this works beautifully as both a getter and setter. I can even pass CSS identifiers instead of the JavaScript camelcase equivalent to it. Is there a compelling reason I shouldn't do it this way?
# IWDiscord <real_devastatia>
# real_devastatia Element.prototype.css = function(property)
# real_devastatia var value = window.getComputedStyle(this, null).getPropertyValue(property);
# real_devastatia {
# real_devastatia if (arguments.length > 1) {
# real_devastatia this.style[property] = arguments[1];
# real_devastatia }
# real_devastatia return value;
# real_devastatia Understood. That's basically my response to "you shouldn't extend prototypes of built-in objects" anyway.
# [jeremycherfas] [Al_Abut] Thanks, I think. The default mode of holding phones vertically does make horizontal aspect ratios odd, but I didn’t realise you were swapping out the phone image for a hand-made crop.
gRegor joined the channel
burley joined the channel
burley joined the channel
# real_devastatia Are you trying to get those sites to explain your autolinking regex?
# real_devastatia What are you parsing with your regex? URLs?
angelo joined the channel
# real_devastatia @line 1313: Would you need to escape the backslashes in the first place if that string was in double quotes rather than single quotes?
# real_devastatia I use filter_var to validate URLs and e-mail addresses. Validating them with regex is a rabbithole I don't want to go down. I messed with it a long time ago and discovered there are as many different solutions as there are e-mail addresses.
# real_devastatia https://www.php.net/manual/en/function.filter-var
# real_devastatia [tantek]: That was gonna be my next question. lol
# [tantek] nah that fails for typical autolink use-cases like this: http://tantek.com <-- autolinkers will link that, filter-var will fail to see it as a URL
# real_devastatia [tantek]: That's surprising. It's about as typical as a URL gets.
# real_devastatia Oh, so you're saying filter_var fails without the scheme (http:// or https://). Yeah, that's true.
# real_devastatia I'd imagine there's some additional pre-processing in UX-driven apps to infer a spec-conformant URL. Browsers are certainly good at figuring out bad HTML in quirks mode.
# real_devastatia The problems I address with filter_var are much simpler than yours, at any rate. When I add a link to a page, I always include the scheme. It broke in one case when a visitor omitted the scheme from their website URL when they posted to my guestbook, but I went into phpMyAdmin and fixed it. I don't encounter the issue frequently enough to need a more robust solution.
# angelo from the last time this came up: https://gist.github.com/angelogladding/97ea7d469c5bd62701db10e6d8e362a8
# angelo mode.. here's some tricks for doing the same in Javascript: https://stackoverflow.com/questions/15463257/commenting-regular-expressions
burley and adele joined the channel
to2ds joined the channel
# to2ds Based on exchanges with iammnchrm the other day, I popped up a hyper-simple Python SSG, intended as a learning tool primarily at https://github.com/toddpresta/w1dino-swg -- it might be kind of oldschool, but I just needed an excuse to create a GH project on my neglected account 😊
# superkuh I take out sections of the regex and put them in lines of comments above the regex line saying what it matches/does in english.