@bcdavid@hachyderm.io
@bcdavid@hachyderm.io avatar

bcdavid

@bcdavid@hachyderm.io

Web developer, mostly front-end. Late-diagnosed #AuDHD.

Mostly will comment on or re-boost things related to web-dev, autism and ADHD.

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

stefan, to webdev
@stefan@gardenstate.social avatar

Is it possible to build a react app with plugin support? Like could an app, given an arbitrary cdn url load it, get the component, pass it props and render it without needing to know about it at build time? I feel like it should be possible but I've never seen an example of that. Perhaps for good reasons as maybe xxs stops that idea from working.

bcdavid,
@bcdavid@hachyderm.io avatar

@stefan Yes, it's possible to do this. Wepback's module federation is an example of a tool that enables this, but it could also be as simple as using a dynamic ESM import. I believe where you import from is still constrained by things like CORS and other security mechanisms, but it is conceptually possible.

bcdavid,
@bcdavid@hachyderm.io avatar

@stefan Don't have any articles off the top of my head (outside of things like Webpack documentation), but this approach of dynamically importing and running arbitrary modules as a way to inject independent apps at run time is one approach used for micro-frontends, so that's another keyword to look into and which probably will get you more hits on search engines and podcasts.

futurebird, to random
@futurebird@sauropods.win avatar

When people talk about the days of mass media in the form of the evening news, Dan Rather, everyone "on the same page" with wistful longing... I get why. The current landscape is chaotic.

But, that period of more centralized media left a lot of people out. It made certain perspectives impossible to contemplate.

Like during the early days of the Gulf War: the antiwar movement was invisible.

bcdavid,
@bcdavid@hachyderm.io avatar

@futurebird As a kid in the 80s, I remember being confused about how many wars I'd hear about, and how nobody ever explained why they happened. Panama was the first one; the way it was reported was no different than a hurricane. The first Gulf War was similar. It wouldn't be until much later that I realized that most adults also did not know why these things were happening.

That is what a highly centralized media environment is like.

mekkaokereke, to random
@mekkaokereke@hachyderm.io avatar

Again for people (racists), complaining about falling birth rates:

The birth rate for women over 40 is not falling. The birth rate for women over 30 is not falling.

What's happening, is girls 15 to 17 are having fewer babies. Kids are having fewer kids.

Also, this is an interesting way of saying that "Teen pregnancy is down, due to sex education and contraception."

In 1991 25% of 15 year olds gave birth before they turned 21. That's bad. Now it's 6%. That's better.

https://npr.org/2023/01/08/1147737247/teen-pregnancy-rates-have-declined-significantly

bcdavid,
@bcdavid@hachyderm.io avatar

@mekkaokereke @chriswho @chasseur I get what you are saying, but your description kind of leaves out the fact that Abdulfattah Jandali was from an extremely wealthy family.

atomicpoet, to random
@atomicpoet@atomicpoet.org avatar

It’s been five years since I closed my Facebook account.

bcdavid,
@bcdavid@hachyderm.io avatar

@atomicpoet Just about 3 years for me.

skinnylatte, to animals
@skinnylatte@hachyderm.io avatar

At the vet again :/ very old dogs, very frequent vet visits

#DogsOfMastodon #dogs

bcdavid,
@bcdavid@hachyderm.io avatar

@skinnylatte Cookie has made my life a little sunnier from a distance. I wish she could know the difference she has made.

joelanman, to programming
@joelanman@hachyderm.io avatar

In Node you can easily load json like this:

const myData = require('data.json')  

is there an equivalent in the new import syntax?

bcdavid,
@bcdavid@hachyderm.io avatar

@joelanman Import type assertions are new, but that is going to be the "proper" way to do it with native ESM going forward. Otherwise the only option is to import filesystem.read and directly read the file. I don't consider it a step backwards; having oddities in Common JS such as being able to import non-JS files has always caused challenges with JS tooling. With import types, it's much easier for tooling to know exactly what it is the import is doing without having to guess.

bcdavid,
@bcdavid@hachyderm.io avatar

@joelanman There's the usual reason: file extensions are only names and can't guarantee anything about what is in the file. Then there's JavaScript reasons, that take a whole lot longer to explain. So I'll throw it into a thread. 1/7

bcdavid,
@bcdavid@hachyderm.io avatar

Node's implementation of Common JS is similar to other module systems. It expects that what you are importing is a text file that is another module, and then uses a Node-specific resolution algorithm to find the module. CJS imports are also done synchronously. 2/7

bcdavid,
@bcdavid@hachyderm.io avatar

This means that Node was able to add unique syntactical sugar to imports: bare imports of JS files without extensions; bare imports using folder names as long as there's an index.js in the folder; synchronous in-line require; and specific support for files with .json extensions, where it will do the work of of parsing the file as JSON for you. 3/7

bcdavid,
@bcdavid@hachyderm.io avatar

ES Modules are designed for the Web and use URIs as module specifiers. So the file extension has to be in the specifier because there isn't a really resolution algorithm outside of the URI indicating exactly where the file is. It can even be completely external using a web URL. So ES module imports are always asynchronous and can never assume the file type by the extension. 4/7

bcdavid,
@bcdavid@hachyderm.io avatar

Like other module systems, ESM still requires the imported file be a text file that is another ES module. The problem is that in modern web-dev, people have many use cases for importing non-JS files; JSON and CSS being the prime examples. 5/7

bcdavid,
@bcdavid@hachyderm.io avatar

In order to provide a way for a URI-based module system to import files that aren't modules in that programming language, you need to provide both the URI and an assertion of what kind of content is in that file. Then the run-time can choose to help you out in a standardized way, such as automatically parsing JSON files. 6/7

bcdavid,
@bcdavid@hachyderm.io avatar

Hopefully that makes sense. This TC39 proposal goes into detail on all of this: https://github.com/tc39/proposal-import-attributes

Also, I've never done a thread in Mastodon, so hopefully the format works. 7/7

bcdavid, to random
@bcdavid@hachyderm.io avatar

I think we should start a betting pool around which Fortune 500 company will be the first to go under as a result of a system crash they could not recover from because too much of their code was generated by LLMs and nobody could understand what the code was doing.

bcdavid,
@bcdavid@hachyderm.io avatar

@sailor_sega_saturn @rook It always annoyed me that the super secret death spot in that Batman episode ended up being in the most blindingly obvious place.

bcdavid, to react
@bcdavid@hachyderm.io avatar

I've been working with React Native for about two years now and have really been trying to give it the benefit of the doubt. I'm done with that. RN is garbage.

blogdiva, to tv
@blogdiva@mastodon.social avatar

ok, so my sons bought a heavily discounted "smart" last xmas. a TCL with Roku plastered all over the box.

is there a way to root these tvs and wipe their OS?

https://www.wired.com/story/roku-terms-of-service-update-locks-tv/

rooting and changing the OS of smart anything, especially phones, need to be at the center of the right to repair movement, not just getting access to software drivers or hardware.

PS: i have avoided activating the Roku nonsense exactly for what the article describes.

bcdavid,
@bcdavid@hachyderm.io avatar

@blogdiva How is this legal?

hi_mayank, to random
@hi_mayank@hachyderm.io avatar

<div>s are cool

i used to be a believer in always using semantic HTML.

then one day i had this epiphany that the underlying element doesn't matter if the role is explicitly overridden.

<ul role=tablist>
<div role=tablist>

<ul role=listbox>
<div role=listbox>

other than elements that have built-in behavior (e.g. <button>/<input>), a lot of semantic elements are just nuisance (especially <ul>/<li>).

divs are totally fine. better, even.

(see also: custom elements)

bcdavid,
@bcdavid@hachyderm.io avatar

@hi_mayank Eh, not sure I can go there. Having a 'role' attribute is nice to make incremental adoption viable, but otherwise it kind of feels like a parameter to an imperative function. In your framing, why have any other element besides '<div>'?

bcdavid,
@bcdavid@hachyderm.io avatar

@swlabr @gerikson

"I have learned a lesson as old as time itself. Bow before my greatness."

simevidas, (edited ) to random
@simevidas@mastodon.social avatar
bcdavid,
@bcdavid@hachyderm.io avatar

@simevidas At a high level I think it's accurate to say the rise of SPAs and JS-first dev is the root cause, but it's worth pointing out that the type of element still matters because adding click handlers to non-interactive elements is an accessibility violation.

BlackAzizAnansi, to random
@BlackAzizAnansi@mas.to avatar

So is this the year of corporations just dropping all pretense and kicking their employees and customers in the ass?

bcdavid,
@bcdavid@hachyderm.io avatar

@Karma_J @BlackAzizAnansi This is clearly the tactic, but also Roe has thrown this whole thing into chaos. We shouldn't have our head in the sand, but at the same time we've seen over the last two years that Roe has completely upended what would be expected results.

LoganFive, to StarTrek
@LoganFive@beige.party avatar

I feel like Bones would be pro-union. He's very good about staying within his job description and not being taken advantage of.

"I'm a doctor, not a bricklayer!"

bcdavid,
@bcdavid@hachyderm.io avatar

@LoganFive Never thought of it this way. He always clearly establishes the boundaries of his expertise, and that part of his character has always been front and center.

RickiTarr, to random
@RickiTarr@beige.party avatar

I wonder how things are going on Twitter...

Portal X @Portal Elon Musk, the Tesla billionaire and founder of X has sadly passed away this morning at the age of 52. 74 Readers added context they thought people might want to know Elon Musk is not the founder of X, formerly known as Twitter. The original founders of Twitter are Jack Dorsey, Noah Glass, Biz Stone, en.wikipedia.org/wiki/Twitter, ... britannica.com/topic/Twitter LU NIRRT [
Ron DeSantis & i @RonDeSantis “Success is not final, failure is not fatal: it is the courage to continue that counts.” - Winston Churchill I T " @ Not shown on X The quote is actually from a Budweiser ad in 1938
Andy Boenau @Boenau It's often safest for a cyclist to go through a red light. Here's an example of safely keeping momentum. Bicycles and motor vehicles should never be treated as equals, so "but red means stop!" isni't a useful reaction. Readers added context they thought people might want to know As per the Highway Code rule 69 cyclists "MUST obey all traffic signs and traffic light signals." With further guidance in rule 71

bcdavid,
@bcdavid@hachyderm.io avatar

@RickiTarr @ParadeGrotesque I appreciate the humanity of your sentiment, and am also not sure that it is wise.

bcdavid,
@bcdavid@hachyderm.io avatar

@Architeuthis @tante I often hear it said that the TREACLE crowd is a section of early 2000s Internet atheists that went on to invent their own god, but I don't think it gets pointed out enough how much stupider their belief system is compared to the religions they constantly mock.

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