@ayo@ayco.io
@ayo@ayco.io avatar

ayo

@ayo@ayco.io

· frontend guy who likes server adventures
· builds & learns in public
· follow for tech, puns, & overthinking

https://mnswpr.com · https://mcfly.js.org · https://webcomponent.io · https://astro-reactive.js.org · https://kaboom.ayco.io · https://ayo.ayco.io/showcase

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

ayo, to random
@ayo@ayco.io avatar
thomasfuchs, to random
@thomasfuchs@hachyderm.io avatar

Gonna enjoy a bananum for breakfast

ayo,
@ayo@ayco.io avatar

@thomasfuchs it just gave up with coconut 🥲

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

Let's say I want to have a web component.

Whenever I use it, I would like to provide a custom callback to run in its context, defining it in HTML.

Is there an idiomatic way to do so? The way I'm thinking of is to use currentScript:

<my-element>
<script> document.currentScript.myCallback = () => console.log('Hey!');</script>
</my-element>

And then call this myCallback from inside the connectedCallback.

Is there anything better (apart from using a unique id for this)?

ayo,
@ayo@ayco.io avatar

@kizu is it absolutely necessary to have the script in the html? Because it looks susceptible to script injection 😬

ayo,
@ayo@ayco.io avatar

@kizu I think jsx has their compiler so it is safer compared to when we have this on the browser. I would not trust users with anything critical. My thinking is just keep to the pattern of providing data and have the logic inside the web component.

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

I recently thought about the different ways you can "have" a place in the Internet:

  • Bare metal
  • Dedicated server
  • Virtual Private Server (VPS)
  • Shared Hosting
  • Serverless
  • fly.io
  • Netlify, Vercel, etc

ayo,
@ayo@ayco.io avatar
  1. Bare metal

You own the physical computer, connect it to the Internet, with a unique IP from your Internet Service Provider (ISP)

It's like owning your piece of land and you have to do all maintenance, taking out all the weeds, pests and whatever. You can maybe pay someone to repair it sometimes. It's the most difficult because you have to think of a lot of things up to the physical needs of your computer (cooling, power, dust, etc.), BUT you also get the most freedom and flexibility.

ayo, (edited )
@ayo@ayco.io avatar
  1. Dedicated server

You sign a contract with server owners to use one their servers

It's like getting a house in a private gated community. You have some land owners where you get a contract and some arrangement on what you can and can't do. You pay them some money as rent and they do maintenance (you don't have to think about the physical computer) and, depending on the arrangement, upgrades can be "fully managed" by them.

ayo, (edited )
@ayo@ayco.io avatar
  1. Virtual Private Server (VPS)

You sign a contract with server owners to use some resource in one of their servers

It's like having an apartment in a high-rise. There are others living in the same building but you do get your privacy to some extent. The terms of the contract can be similar to a Dedicated server and you get similar flexibility and freedoms too, but it's cheaper.

ayo, (edited )
@ayo@ayco.io avatar
  1. Shared Hosting

You sign a contract to share a server with others

It's like living in a dormitory. You get a bed and a cabinet, but you have to get in line to use the shower room. Definitely cheaper than the others above but other people might use your toothbrush or eat your snacks.

ayo,
@ayo@ayco.io avatar
  1. Serverless

You run a command that spawns a process in a server

It's like renting a locker with an address on-demand. It works. People will have a way to find you and you can leave stuff there, and you only pay when you use it.

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

I don’t know how to classify https://fly.io — looks like shared hosting on the edge (close to users)

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

Netlify, Vercel, etc

They host your files and provide a way to run functions on their servers for a price (or for free)

It’s very convenient like a hotel with lots of smiles welcoming new travelers but you get kicked out if you end up having tons of visitors. Bills can quickly rise when you eat the snacks in the mini fridge

ayo,
@ayo@ayco.io avatar

@anze3db I need to try that! 🤩

ayo,
@ayo@ayco.io avatar

@schizanon I didn’t know about that and highly likely I missed other ways. 😄 Thanks for mentioning!

ayo,
@ayo@ayco.io avatar

@anze3db is https://fedidevs.com running on a raspberry pi? 😲

ayo,
@ayo@ayco.io avatar

@anze3db that’s super cool 🤩

hi_mayank, to random
@hi_mayank@hachyderm.io avatar

anyone know of a javascript web framework that satisfies the following:

  1. doesn't randomly break every few weeks
  2. doesn't shit itself when you do anything complex
  3. lets you use all HTML/CSS features without making you suffer
ayo,
@ayo@ayco.io avatar

@hi_mayank hono is just writing a server that works on several runtimes, so yeah it lets you use html and css as you want. It’s comparable to https://nitro.unjs.io so check that out it you want options.

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

@hi_mayank aaaand if you strictly just wanna write html & css feel free to try my experimental https://mcfly.js.org — though highly likely something will break as I am not working on it recently 😄

ayo, to random
@ayo@ayco.io avatar

I am kind of restricted by my kid from touching any laptop ‘cause “I should not work in vacation” — so I decided to plan features first like this. Now he is interested and asks “Dad can you explain what this means?”

We just had a conversation about .md files. 😄

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

will continue working on my /signup page: https://www.twitch.tv/ayoayco

ayo,
@ayo@ayco.io avatar

client-side validation provided by HTML; now we handle the form submission server-side and try to add to a DB

ayo,
@ayo@ayco.io avatar

I don't know what I'm doing, so I will just follow a sqlite + flask tutorial

👉 https://realpython.com/flask-database/

ayo,
@ayo@ayco.io avatar

(then I can migrate to postgresql later, or not)

ayo,
@ayo@ayco.io avatar

got into some confusion with setting env vars, the tutorial suggested I use .env, which I did, but I forgot I was using config.json already and so the .env stuff was getting overridden

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

we're getting there! added the first row

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

aaaand we have a first subscriber! :mastodondance:

commit: https://ayco.io/sh/ori/commit/c4e25cce1cc5d757b131ad249be62054c0c5f8a1

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