fsf, to javascript
@fsf@hostux.social avatar

Nonfree may be taking away your freedom without your realizing it! Many web sites require proprietary JavaScript. Nonfree JavaScript subjugates users in the same way as any piece of proprietary software. Learn more: https://u.fsf.org/freejs

rauschma, to javascript
@rauschma@fosstodon.org avatar


This is legal syntax:

Why? You can use numbers as keys in object literals. That can be useful for destructuring [1]:

> const {0:a, 2:c} = ['zero', 'one', 'two'];
> a
> c

However, this is not legal syntax:
> const x = {3};
SyntaxError: Unexpected number

Why? This is called a property value shorthand [2] and only works with names of variables.

[1] https://exploringjs.com/impatient-js/ch_destructuring.html
[2] https://exploringjs.com/impatient-js/ch_objects.html#object-literals-property-value-shorthands

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
croc, to webdev
@croc@mastodon.social avatar

🤓 This is gonna be a extremely nerdy toot, but my most favorite piece of code I ever wrote is a small TypeScript library complete with unit tests that makes it super simple to filter a list of domain names by various criteria.


#domains #webdev #code #typescript #javascript

toxi, to genart
@toxi@mastodon.thi.ng avatar

Little Friday night gift for a friend (& example in ): How to generate & then recursively tessellate a hex grid and visualize as SVG, all via just https://thi.ng/geom & https://thi.ng/transducers...


Source code:

(cc @nkint)

@toxi@mastodon.thi.ng avatar

(Almost) same code, alternative tessellation (swapped order: first quad fan, then edge split). Also using 4 colors (vs two) to tint result polys...

@toxi@mastodon.thi.ng avatar
@toxi@mastodon.thi.ng avatar
aral, to SmallWeb
@aral@mastodon.ar.al avatar

Kitten bugfix release:

Please upgrade to the latest release that fixes a regression introduced into sessions object with the latest JSDB¹/JSDF² upgrade:


Persisting arbitrary objects to sessions is a supported workflow and this regression broke that.

e.g., See the Kitten Count Sessions example: https://codeberg.org/kitten/app/src/branch/main/examples/kitten-count-sessions/index.page.js


¹ https://codeberg.org/small-tech/jsdb#javascript-database-jsdb
² https://codeberg.org/small-tech/jsdb#javascript-data-format-jsdf

#Kitten #SmallWeb #web #dev #sessions #JSDB #JavaScript #database #regression

twilliability, to javascript
@twilliability@genart.social avatar

Question folks! If I use destructuring assignment as below, is an actual array allocated for the function's return value, or does the runtime recognize this and optimize it away?

Asking for a friend living in a tight loop.

const [a, b] = foo();

martinpeck, to python
@martinpeck@fosstodon.org avatar

A lot of of people on social media such as LinkedIn will post "What do you think this python code will do? A, B, or C" questions.

Are these useful to anyone?

The code is generally of a style I'd recommend people avoid writing, or that I'd question in a code review. Often it's using strange edge-cases for what's possible...but not what's idiomatic or "good".

I can't imagine they're useful to people learning . I imagine they deter some people from using . Am I wrong?

@martinpeck@fosstodon.org avatar

It's also not a phenomenon specific to . I see the same thing with other languages (most often with )

eikun_0903, to javascript Japanese
@eikun_0903@fedibird.com avatar
nurkiewicz, to javascript
@nurkiewicz@fosstodon.org avatar

"Top 5 Cutting-Edge #JavaScript Techniques". TL;DR:

  1. Monads (Asynchronous Operations)
  2. Declarative Programming
  3. Server-Side Caching for Improved Node.js Performance
  4. Immutability
  5. Pattern Matching


aral, to SmallWeb
@aral@mastodon.ar.al avatar

New Video – Kitten features introduced this week:

• Interactive Shell (REPL)
• Multi-page Settings
• Backup and restore (data portability)

With examples that cover components and Kitten’s built-in JavaScript database (JSDB).



#Kitten #SmallWeb #SmallTech #web #dev #JavaScript #HTML #database #JSDB #components #settings #dataPortability #REPL

slacle, to genart
@slacle@mastodon.social avatar
siblingpastry, (edited ) to keyboard
@siblingpastry@mastodon.world avatar

I've been playing around with keyboard scrolling of overflow regions, and I was interested to note how Firefox's native behavior doesn't expose any additional semantics -- i.e., it doesn't apply a role or accessible name when the scrolling region becomes focusable.

And I think that's the right thing to do -- that our standard workaround of including role="region" and aria-label or aria-labelledby (along with tabindex="0") creates unnecessary verbosity.


siblingpastry, (edited )
@siblingpastry@mastodon.world avatar

I've created a demo script on that basis, which doesn't add a role or label, it simply adds or removes tabindex based on whether the region actually has overflowing content.

It's triggered by a ResizeObserver so it continually updates in response to anything that changes the element's size (and you can test this by resizing the window, increasing zoom or font-size).


Thoughts etc.?


aral, to SmallWeb
@aral@mastodon.ar.al avatar

So! Many! Kittens!

(Going to record a demo of the new interactive shell – REPL to some – and multi-page Settings this afternoon, just planning it out now.)

Oh and is that me creating and calling web routes interactively in the REPL on a live server? Why yes, yes it is.


markstos, to javascript
@markstos@urbanists.social avatar

Is EventEmitter the GOTO of ?

nucliweb, to javascript
@nucliweb@webperf.social avatar
aral, to SmallWeb
@aral@mastodon.ar.al avatar

:kitten: Kitten’s interactive shell (REPL) now saves session history scoped to your app so it will still be there when you next serve the same app.


I think I’m done with the REPL feature now.

Going to take a little break, step away from the computer, and make a plan for the next week of work on Kitten and Domain¹.

¹ https://codeberg.org/domain/app

stvfrnzl, to webdev
@stvfrnzl@mastodon.online avatar

I finally got for @astro working! Thanks to @henry sparking my interest for it (again) and anyone here who helped me along the way.


I would appreciate lots of likes, reposts and comments so I have more data to work with hehe

rauschma, to javascript
@rauschma@fosstodon.org avatar

Upcoming iterator methods:

// Without iterator methods:
const arr = Array.from(myMap.keys())
.filter(k => isPublic(k));

// With iterator methods:
const arr = myMap.keys()
.filter(k => isPublic(k))

(I prefer not to do .filter(isPublic) because isPublic() may gain more parameters in the future.)


marmelab, to php
@marmelab@mastodon.social avatar

🎉 Exciting news! Marmelab is sponsoring the API Platform Conference 2024, the flagship event dedicated to the API Platform framework!

Join us for 2 days of talks by leading experts in , & .

📅 19 & 20 September
📍 Lille, France

Learn more: https://api-platform.com/fr/con/2024/


nucliweb, to javascript
@nucliweb@webperf.social avatar

async scripts, defer scripts, module scripts: explainer, comparison, and gotchas


ramikrispin, to datascience
@ramikrispin@mstdn.social avatar

Getting Started with Observable Framework 👇🏼

Here is a great resource for getting started with Observable Framework by Allison Horst. Observable Framework is an open-source JS library for creating dashboards. The sequence of videos covers how to set up a project and data loader, customize the dashboard, and deploy it.

📽️ https://www.youtube.com/playlist?list=PLOHIJAFwtkEcuVZO6WK-Uuswd09Y2Rk2b

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