Search
JavaScript Labels
15.1.2019
No matter how long you’ve been a JavaScript developer, there will always be language features that you didn’t know about until you saw them in a fringe piece of code. Your reaction generally is a bit like: One of those features I see developers quizically trying to figure out...
Using React Portals to Render Children Outside the DOM Hierarchy
15.1.2019
Say we need to render a child element into a React application. Easy right? That child is mounted to the nearest DOM element and rendered inside of it as a result.
render() {
return (
<div>
// Child to render inside of the div
</div>
);
}
But! What if we want...
Collective #483
14.1.2019
The Flexbox Holy Albatross * destyle.css * Conversations with Robots * 2018 JavaScript Rising Stars
Collective #483 was written by Pedro Botelho and published on Codrops
Piecing Together Approaches for a CSS Masonry Layout
11.1.2019
Masonry layout, on the web, is when items of an uneven size are laid out such that there aren't uneven gaps. I would guess the term was coined (or at least popularized) for the web by David DeSandro because of his popular Masonry JavaScript library, which has been around since 2010.
JavaScript...
Converting Color Spaces in JavaScript
10.1.2019
A challenge I faced in building an image "emojifier" was that I needed to change the color spaces of values obtained using getImageData() from RGB to HSL. I used arrays of emojis arranged by brightness and saturation, and they were HSL-based for the best matches of average pixel colors with...
Collective #482
10.1.2019
Anime.js v3.0.0 * Dimensions.Guide * Defensive JavaScript * Bg Painter * Web A Skeb * The Ethics of Performance
Collective #482 was written by Pedro Botelho and published on Codrops
New ES2018 Features Every JavaScript Developer Should Know
9.1.2019
The ninth edition of the ECMAScript standard, officially known as ECMAScript 2018 (or ES2018 for short), was released in June 2018. Starting with ES2016, new versions of ECMAScript specifications are released yearly rather than every several years and add fewer features than major editions used...
Toggling Animations On and Off
9.1.2019
A nicely detailed tutorial by Kirupa that gets into how you might provide a UI with persisted options that control whether animations run or not.
The trick is custom properties that control the movement:
body {
--toggle: 0;
--playState: "paused";
}
Which are used within animations...
Styling a Web Component
8.1.2019
This confused me for a bit here so I'm writing it out while it's fresh in mind. Just because you're using a web component doesn't mean the styles of it are entirely isolated. You might have content within a web component that is styled normally along with the rest of your website. Like this:
See...
The practical value of semantic HTML
7.1.2019
I love how Bruce steps up to the plate here:
If the importance of good HTML isn’t well-understood by the newer breed of JavaScript developers, then it’s my job as a DOWF (Dull Old Web Fart) to explain it.
Then he points out some very practical situations in which good HTML brings meaningful...
Jak nejlépe spočítat faktoriál v JavaScriptu?
4.1.2019
Nedávná diskuse na Facebooku mě přiměla, abych toto téma prozkoumal do větších detailů, než mi umožňovaly tamní komentáře. Tato otázka totiž kupodivu nemá jednoduchou odpověď. Když o ní začnete více přemýšlet, ponoříte se do některých zajímavějších oblastí JavaScriptu, které možná ne všichni znají
Collective #480
3.1.2019
UI Sounds * Learn JavaScript * Buddience * Blendy * Algorithmic Layouts * Blobmaker * The History of Everything
Collective #480 was written by Pedro Botelho and published on Codrops
Background Sync with Service Workers
3.1.2019
Service workers have been having a moment. In March 2018, iOS Safari began including service workers — so all major browsers at this point support offline options. And this is more important than ever — 20% of adults in the United States are without Internet at home, leaving these...
Collective #479
27.12.2018
Annual Awards 2018 * imgbb * screen.guru * Fiddly * Neural networks in JavaScript * Magic Grid * Flameout
Collective #479 was written by Pedro Botelho and published on Codrops
Nested Destructuring
25.12.2018
Destructuring in JavaScript can initially feel confusing but the truth is that destructuring can make your code a bit more logical and straight forward. Destructuring does look a bit more complex when you’re looking for a property several objects deep, so let’s have a look at how to...
Force Download with JavaScript
24.12.2018
Force download scripts have been an important part of internet usability for a long time.  I can attest to that by the number of times I’ve implemented this feature on the server side and the popularity of my PHP Force Download post, even to this day.  With the web world having...
Collective #478
20.12.2018
#merryCSSmas * JavaScript Getter-Setter Pyramid * XmasTree Game * Ouch! * WakeLock API * Reversing an Easing Curve
Collective #478 was written by Pedro Botelho and published on Codrops
How to Worry About npm Package Weight
18.12.2018
It's all too easy to go crazy with the imports and end up with megabytes upon megabytes of JavaScript. It can be a problem as that weight burdens each and every visitor from our site, very possibly delaying or stopping them from doing what they came to do on the site. Bad for them, worse for you....
Build a Secure Node.js Application with JavaScript Async Await Using Hapi
18.12.2018
At the core of the JavaScript language is its asynchronous programming model. Unfortunately, dealing with callback functions has long been a source of frustration for many developers. JavaScript Pr
CSS Ellipsis Beginning of String
18.12.2018
I was incredibly happy when CSS text-overflow: ellipsis (married with fixed width and overflow: hidden was introduced to the CSS spec and browsers; the feature allowed us to stop trying to marry JavaScript width calculation with string width calculation and truncation. CSS ellipsis was also very...