@tbroyer@piaille.fr avatar

tbroyer

@tbroyer@piaille.fr

Web development (frontend, Web APIs), Web app security, build tools, Java, Kotlin, Gradle, etc.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

develwithoutacause, to javascript
@develwithoutacause@techhub.social avatar

#JavaScript #CodeReview: Always use === over ==.

=== applies much more reasonable behavior for operands of different types, mainly by not coercing them together like == does.

A lot of developers will tell you to learn the rules of coercion and use it when appropriate, however I disagree for one key reason. Consider this example:

if (foo == bar) {  
 doSomething();  
}  

Question: Did the developer mean to use ==? Is the coercion intended or a typo?

It's incredibly difficult to know with any amount of certainty as this depends on the types and semantics of foo and bar.

If I was writing this intentionally, I would feel compelled to write a several line comment about how coercion behavior applies here in a desirable way. And if you need to write that much explanation, it would be much less confusing to actually codify the desired behavior with === and explicit type checks so devs don't have to understand that coercion.

tbroyer,
@tbroyer@piaille.fr avatar

@develwithoutacause @flensrocker Pareto law: it's much more common for null/undefined to be interchangeable than being treated differently, so == null without comment, and add a comment whenever you need === null/=== undefined.

ayo, (edited ) to random
@ayo@ayco.io avatar

What’s your preferred app configuration format? Comment explanations or answers not in options (I can only add 4)

🙏 pls for science

tbroyer,
@tbroyer@piaille.fr avatar
nixCraft, to random
@nixCraft@mastodon.social avatar

Don't lie to me: How many browser tabs do you have open right now? 🤔

tbroyer,
@tbroyer@piaille.fr avatar

@nixCraft You don't want to know. I don't want to know. Let's just say new tabs can no longer be seen in the tab bar 🫣 (in both pro and perso profiles)

rauschma, to random
@rauschma@fosstodon.org avatar

I’m ambivalent about ad blockers:
– I understand why people use them—most ads have become nasty and obtrusive.
– There really aren’t many good alternatives to ads for content creators: People aren’t willing to pay for content but don’t like ads either.

What are your thoughts?

tbroyer,
@tbroyer@piaille.fr avatar

@leeloo @rauschma Not a good metaphor if you ask me. Those who see the ad (or graffiti) on the trains aren't the train owners, they're people who didn't ask for anything and see the train pass by (and train spotters of course, they're not there for the ad either), or passengers at the train station before getting on the train.

Ad networks pay site owners to show ads to whoever "passes by"; they come for the content, and see the ads (more like billboards, that don't move, rather than trains though I'd say).

I do use a blocker because of abusive behaviors. I wouldn't mind less intrusive and more secure and privacy friendly ads.

tbroyer,
@tbroyer@piaille.fr avatar

@leeloo @rauschma Are TV ads graffiti?

(and you're still in control of your screen: don't you choose to visit websites whose owners chose to be paid to have ads?)

melix, to random French
@melix@mastodon.xyz avatar

Au mémorial de Caen. En ces temps où l'extrême droite est au plus haut, une piqûre de rappel bienvenue. Tous les jeunes devraient voir ça.

image/jpeg

tbroyer,
@tbroyer@piaille.fr avatar

@melix Dans notre coin de la France, on va plus facilement voir le camp de concentration de Natzweiler-Struthof

(un jour, il faudra quand même que j'aille à Caen)

csscade, to random
@csscade@mastodon.social avatar

Okay, so when making a popover I think the logic should go something like this:

  1. Use title if the content of the popover is just text.

  2. Use the popover attribute if the content is more than plain text and like a menu of options or something.

  3. Use <dialog> if you need to force the user to make a decision or block all other interactions on the page.

https://www.csscade.com/popover-api

tbroyer,
@tbroyer@piaille.fr avatar

@hdv @SaraSoueidan @csscade …now waiting for anchor positioning to make it even easier to position those tooltips (a coworker noted last week when popover became "baseline" that it wasn't really useful without anchor positioning)

melix, to random French
@melix@mastodon.xyz avatar

Les gens qui disent "la Devoxx", ou "au Devoxx", vous dites "la Nantes" ou "au Bordeaux" aussi ?

tbroyer,
@tbroyer@piaille.fr avatar

@melix Ils disent probablement "les Metallica", "les Imagine Dragons", "les Panic! at the Disco", "les Ofenbach" aussi (c'est les premiers qui me sont venus à l'esprit mais je sais qu'il y a bien pire dans le genre "ça n'a aucun sens")

tbroyer,
@tbroyer@piaille.fr avatar

@melix "les pierres qui roulent" c'est déjà un groupe nominal pluriel, donc c'est plutôt "normal" même d'utiliser un article, comme pour "les 3 cafés gourmands" c'est pas choquant.
Par contre pour "Noir Désir" ou "Téléphone", ça n'a absolument aucun sens de mettre "les".

Mais pour revenir au sujet, "le Devvoxx" ou "la Devvoxx" peut faire référence à l'événement/la conférence, donc si ça te choque pas pour un nom de groupe pour qualifier ses membres, pourquoi ça te dérange ici ? 😉

(en vrai, c'est un sujet aussi clivant que "la wifi" ou "le covid", la diff. étant que Devvoxx est une marque donc peut définir l'usage officiel dans ses "branding guidelines")

jaffathecake, to random
@jaffathecake@mastodon.social avatar

📝 HTML attributes vs DOM properties.

They're completely different, but often coupled.

Here's the difference, and why it matters: https://jakearchibald.com/2024/attributes-vs-properties/

tbroyer,
@tbroyer@piaille.fr avatar

@jaffathecake Great post (as always)

Somewhat related (the first part): https://blog.ltgt.net/web-component-properties/

Kilian, to random
@Kilian@mastodon.social avatar

The problem with new URL(), and how URL.parse() fixes that

A non-throwing way of parsing a URL is coming to browsers!

https://kilianvalkhof.com/2024/javascript/the-problem-with-new-url-and-how-url-parse-fixes-that/

tbroyer,
@tbroyer@piaille.fr avatar
b0rk, (edited ) to random
@b0rk@jvns.ca avatar

poll: to switch branches in git, do you use git checkout or git switch?

tbroyer,
@tbroyer@piaille.fr avatar

@b0rk It took me some time to… switch (sic!) from checkout to switch (and restore) but it didn't actually took me much effort once I decided to do it. I don't think I'll ever go back.

ppk, to random
@ppk@front-end.social avatar

Why is Gimp so fucking incomprehensible?

tbroyer,
@tbroyer@piaille.fr avatar

@ppk Depending on your needs, Photopea.com or similar might be good enough.

Otherwise maybe have a look at Krita (https://krita.org/) It's more oriented towards drawing thean photo editing but it looks like it has most (all?) editing tools, and can even open PSD files.

jessewilson, to random
@jessewilson@cosocial.ca avatar

Oh, You Love Taylor Swift? Name One Hundred of Her Albums

tbroyer,
@tbroyer@piaille.fr avatar

@jessewilson "One Hundred (Taylor's Version)"

konnorrogers, to random
@konnorrogers@ruby.social avatar

Wrote an article on how to fix the "reflected attribute" issue faced when you set properties in a constructor with Lit and why it happens

https://www.konnorrogers.com/posts/2024/designing-web-components-for-morphing

tbroyer,
@tbroyer@piaille.fr avatar

@konnorrogers I have no idea what morphing operation you're talking about, but setting the attributes from constructor initialization is clearly a bug (only happens when not using decorators, and a known issue: https://github.com/lit/lit/issues/1476) and IMO this should be worked around using getter/setter (which can also easily solve the question of what to do when the property is set to null/undefined or the attribute is removed)
See https://blog.ltgt.net/web-component-properties/ for my take on reflected properties.

aeris, to random French
@aeris@firefish.imirhil.fr avatar

Sérieusement, je pète un plomb depuis tout à l’heure avec ça… Quelqu’un voit le problème avec ce certificat ? 🤔
https://paste.imirhil.fr/?726602cfd9263b9d#Lt4knmlS63vCEGGkz6lQF8lwE4DIkYg3eocyB2mGyCs=

tbroyer,
@tbroyer@piaille.fr avatar

@themr0c @Norore @aeris "bad cert domain" ça me paraîtrait bizarre pour indiquer un auto signé quand même 🤔

tbroyer,
@tbroyer@piaille.fr avatar

@Norore Ce message là je l'avais compris oui 😉

nixCraft, to random
@nixCraft@mastodon.social avatar

PHP was originally an abbreviation of Personal Home Page 🤔 did you know that?

tbroyer,
@tbroyer@piaille.fr avatar

@nixCraft Of course!
(I started with PHP/FI)

tbroyer, to Java
@tbroyer@piaille.fr avatar

connect2id's Nimbus OAuth2/OIDC SDK is underrated, particularly as a direct dependency!

https://connect2id.com/products/nimbus-oauth-openid-connect-sdk

Many people use it through Spring Security or Pac4j but the lib is relatively easy to use directly (particularly if you know the protocols) and can be used to add OIDC support to Java apps with much less complexity than those Spring or Pac4j authentication frameworks (but at the cost of having to handle some of the Web security yourself, mainly around CSRF)

heybran, to javascript
@heybran@mastodon.online avatar

Using inline events handlers inside vanilla side project is kinda nice, what do you think? Love the freedom and joy of writing vanilla .

https://heybran.cn/blog/web-components-inline-event-handlers/

tbroyer,
@tbroyer@piaille.fr avatar

@heybran The first drawback I can think of is about CSP, where you'd have to use unsafe-inline or unsafe-hashes (there's a reason their name includes the word unsafe)

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src

hi_mayank, to random
@hi_mayank@hachyderm.io avatar

this is absolutely wild! facebook needs not one but TWO different syntax extensions to JS to make their framework usable.

and you still can't write a regular <style> tag in it 🫠

https://scribe.rip/flow-type/announcing-component-syntax-b6c5285660d0

tbroyer,
@tbroyer@piaille.fr avatar
rauschma, to random
@rauschma@fosstodon.org avatar

HTML entities in Markdown—for HTML and other output formats:
– Which ones would you support?
– For most entities, using the Unicode character directly seems like the best solution(?)
– I can’t think of any exceptions. Maybe:  

tbroyer,
@tbroyer@piaille.fr avatar

@rauschma Maybe ­ too, and basically any non-printable character, e.g. &; and maybe &; (no idea if they have names in HTML, and U+200C might be enough/better as direct Unicode character as it should have a visible effect): https://invisible-characters.com/

tbroyer,
@tbroyer@piaille.fr avatar

@idleberg @rauschma @max More than readability, I'd say writability: it's easier/faster to type a shortcode than reach for an emoji keyboard (or other input helper) and find the appropriate emoji. Not all setups have (usable) shortcuts to easily type emojis.

tbroyer,
@tbroyer@piaille.fr avatar

@max @idleberg @rauschma

> Today emoji keyboards are in all major OSes and an easy key press away.

That's a wild generalization from Windows and Mac (on desktop).

As I said:
> Not all setups have (usable) shortcuts to easily type emojis.

See also https://issues.chromium.org/issues/40113488 for some fun.

melix, to random
@melix@mastodon.xyz avatar

At the risk of repeating myself, Maven's "closest" resolution strategy sucks a million. Sorry but I'm literally spending hours trying to figure out why a version declares in an imported BOM doesn't take precedence. And it's a fairly complex project with hundreds of deps, each overriding each others' dependency management blocks, because yeah sure that's the only way you can make that thing use the version you want, right? Let me cry.

tbroyer,
@tbroyer@piaille.fr avatar

@melix Did you try mvn help:effective-pom -Dverbose?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • normalnudes
  • khanakhh
  • magazineikmin
  • Youngstown
  • cisconetworking
  • slotface
  • everett
  • mdbf
  • thenastyranch
  • kavyap
  • rosin
  • InstantRegret
  • PowerRangers
  • DreamBathrooms
  • anitta
  • vwfavf
  • hgfsjryuu7
  • tester
  • Durango
  • osvaldo12
  • tacticalgear
  • ngwrru68w68
  • GTA5RPClips
  • ethstaker
  • Leos
  • modclub
  • cubers
  • provamag3
  • All magazines