On April 15, 2025 at 13:48
Responded to @kasparsd:
Object.fromEntries() π ES2019
const entries = [ ['a', 1], ['b', 2] ];
Object.fromEntries(entries);
returns { a: 1, b: 2 }.
Responded to @kasparsd:
Object.fromEntries() π ES2019
const entries = [ ['a', 1], ['b', 2] ];
Object.fromEntries(entries);
returns { a: 1, b: 2 }.
Responded to @kasparsd:
Object.entries() π ES2017
const obj = { a: 1, b: 2 };
Object.entries(obj);
returns [ ['a', 1], ['b', 2] ] which is useful for mapping.
Responded to @kasparsd:
Property Shorthand π ES6 (2015)
const x = 1, y = 2;
const point = { x, y };
Less typing, same object.
Responded to @kasparsd:
Object Spread for Merge π ES2018
const a = { x: 1 };
const b = { y: 2 };
const c = { …a, …b };
Merges like magic (shallow copy).
Responded to @kasparsd:
Computed Property Names π ES6 (2015)
const key = 'foo';
const obj = { [key]: 123 };
Turns variable value into a property key. Syntax sugar for obj[key] = 123.
Responded to @kasparsd:
Nested Destructuring π ES6 (2015)
const user = { profile: { name: 'Ada' } };
const { profile: { name } } = user;
Same as name = user.profile.name;
And you can rename the variable name to userName:
const { profile: { name: userName } } = user;
Responded to @kasparsd:
Destructuring with defaults π ES6 (2015)
const { foo = 'default' } = {};
Sets the default value of foo to 'default' if the value isn't defined.
JavaScript object tricks that look weird but work wonders (and when they were added to the language.
If you've ever seen { [key]: value } and thought βwhat the heck?β — this thread is for you.π
Was chatting with an AI about Zero-Knowledge (ZK) proofs and how they relate to backtraces and public-key crypto (concepts I know):
> Imagine a PHP backtrace, turned into a spreadsheet, hashed into a Merkle root, and then proved using fancy math that it obeyed all your function contracts without ever showing you the contents. π€―
Built the ultimate login/logout block that works with the WP core navigation block. Use it to:
– Display only the logout link for logged-in users.
– Display only the login link for anonymous users.
– Specify a custom page (any post type) as the login destination.
Responded to @kasparsd:
Here is a link to the "bits" proposal: https://github.com/WordPress/gutenberg/discussions/39831
Responded to @kasparsd:
There are inline images but they don't support any block attributes and are placed as simple inline markup.
Do we really need to wait for the block bits (a shortcode replacement) to enable dynamic content inside inline elements? Currently there isn't a way to display the post title as a paragraph tag in a query loop block, for example.
Responded to @kasparsd:
Importantly, it doesnβt matter if just one sitemap is slow to respond β it will still encourage Google to throttle crawling.
Most of the popular SEO plugin sitemap implementations are known to have both issues on sites with 10k posts or more β there is a delay in regeneration and the dynamic response times can be 30 seconds and more even on dedicated enterprise hosting.
Make sure your sitemaps are quick to update and fast to render at ALL times!
I see a lot of publishers struggle with timely search engine indexing after publishing or updating an article. This happens because:
(1) the update invalidates the sitemap cache and Google sees a long response time due to regeneration which makes it apply crawl throttling as the site appears to be overloaded; or
(2) the sitemap returns stale content (without the new article URL) because there is a delay in regeneration.
Responded to @kasparsd:
Iβve created a repository with minimal configuration to replicate all of these issues: https://github.com/kasparsd/wp-scripts-build-issues
And here is the pull request to fix them: https://github.com/WordPress/gutenberg/pull/69828
I wish wp-scripts considered all JS files in the ./src directory as webpack entrypoints. The current behaviour is very unpredictable and broken:
1. No way to specify individual JS files as entry points while keeping the blocks/*/block.json parsing.
2. Ignores src/index.js entrypoint if src/blocks/*/blocks.json is present.
If you're mostly on other social networks, follow me on:
– LinkedIn https://www.linkedin.com/in/kaspars-dambis/
– Twitter https://x.com/konstruktors
– Bluesky https://bsky.app/profile/kaspars.damb.is
– Threads https://www.threads.net/@wpelevator
With two-factor authentication it is often overwhelming to decide on how to set it up right. Do you think these "recommended" labels and the ordering of methods make it easier? How else could we improve it?
See this issue for context: https://github.com/WordPress/two-factor/pull/676
Version 0.13.0 of the Two Factor plugin for WordPress is out! π
It features a new filter to limit the available two-factor methods for each user. Useful for disabling less secure methods for super-admins, for example.