#techsource #article #davidwalsh
Match Accented Letters with Regular Expressions
Join Us @techbite @cosmotory
URL: https://bit.ly/3gyCSEN
Match Accented Letters with Regular Expressions
Join Us @techbite @cosmotory
URL: https://bit.ly/3gyCSEN
David Walsh Blog
Match Accented Letters with Regular Expressions
Regular expressions are used for a variety of tasks but the one I see most often is input validation. Names, dates, numbers…we tend to use regular expressions for everything, even when we probably shouldn’t. The most common syntax for checking alphabetic…
#techsource #article #davidwalsh
Simple Node.js Proxy
Join Us @techbite @cosmotory
URL: https://bit.ly/3l0kc3I
Simple Node.js Proxy
Join Us @techbite @cosmotory
URL: https://bit.ly/3l0kc3I
David Walsh Blog
Simple Node.js Proxy
When I wanted to refresh my React.js skills, I quickly moved to create a dashboard of cryptocurrencies, their prices, and and other aspects of digital value. Getting rolling with React.js is a breeze — create-react-app {name} and you’re off and running. Getting…
#techsource #article #davidwalsh
Match Emojis with Regular Expressions
Join Us @techbite @cosmotory
URL: https://bit.ly/2YehlKu
Match Emojis with Regular Expressions
Join Us @techbite @cosmotory
URL: https://bit.ly/2YehlKu
David Walsh Blog
Match Emojis with Regular Expressions
When experimenting with unicode property escapes, to identify accented letters in strings, it reminded me of a question I had a few years ago: what is the best way to identify and then replace emojis in a string? I first noticed this practice when using emojis…
#techsource #article #davidwalsh
Logical Assignment Operators
Join Us @techbite @cosmotory
URL: https://bit.ly/3hjLoXO
Logical Assignment Operators
Join Us @techbite @cosmotory
URL: https://bit.ly/3hjLoXO
David Walsh Blog
Logical Assignment Operators
I love JavaScript, it’s my favorite programming language, but I love dipping into other languages because they offer a new perspective on coding paradigms. There’ve been syntax additions to JavaScript that I’ve seen I found interesting (think ?? in optional…
#techsource #article #davidwalsh
5 Awesome JavaScript Promise Tricks
Join Us @techbite @cosmotory
URL: https://bit.ly/3iuDBrL
5 Awesome JavaScript Promise Tricks
Join Us @techbite @cosmotory
URL: https://bit.ly/3iuDBrL
David Walsh Blog
5 Awesome JavaScript Promise Tricks
The Promise API changed the game in JavaScript. We went from abusing setTimeouts and settling for synchronous operations to doing everything possible to leverage this new async API. Let’s check out a handful of awesome Promise API tricks! Cancel a fetch Request…
#techsource #article #davidwalsh
Remove the Search Input Clear(x) Icon
Join Us @techbite @cosmotory
URL: https://bit.ly/3ktDM7g
Remove the Search Input Clear(x) Icon
Join Us @techbite @cosmotory
URL: https://bit.ly/3ktDM7g
David Walsh Blog
Remove the Search Input Clear(x) Icon
I really appreciate the amount of different <input> elements we’ve received over the past decade. These elements don’t just bring a new semantic advantage, but also provide UI helpers, which in many cases are useful. In a recent case, I found a UI element…
#techsource #article #davidwalsh
Vital Web Performance
Join Us @techbite @cosmotory
URL: https://bit.ly/3kzJWTm
Vital Web Performance
Join Us @techbite @cosmotory
URL: https://bit.ly/3kzJWTm
David Walsh Blog
Vital Web Performance
I hate slow websites. They are annoying to use and frustrating to work on. But what does it mean to be “slow”? It used to be waiting for document load. Then waiting for page ready. But with so many asynchronous patterns in use today, how do we even define…
#techsource #article #davidwalsh
How to Create an Async Function
Join Us @techbite @cosmotory
URL: https://bit.ly/2Ey8qNw
How to Create an Async Function
Join Us @techbite @cosmotory
URL: https://bit.ly/2Ey8qNw
David Walsh Blog
How to Create an Async Function
One thing I love about JavaScript is that there are many ways to accomplish the same task, one such example being creating functions. There are several patterns for functions; one of the last you see used is the new Function method: /* new Function(arg1,…
#techsource #article #davidwalsh
How to Detect the Default Branch in a git Repository
Join Us @techbite @cosmotory
URL: https://bit.ly/2S5sObR
How to Detect the Default Branch in a git Repository
Join Us @techbite @cosmotory
URL: https://bit.ly/2S5sObR
David Walsh Blog
How to Detect the Default Branch in a git Repository
Using the "git remote show REMOTE_REPO_NAME | grep 'HEAD branch' | cut -d' ' -f5" command provides you the default branch name for a given git repository.
#techsource #article #davidwalsh
Shoelace 2.0: A Forward-thinking Library of Web Components
Join Us @techbite @cosmotory
URL: https://bit.ly/2Hy4VYm
Shoelace 2.0: A Forward-thinking Library of Web Components
Join Us @techbite @cosmotory
URL: https://bit.ly/2Hy4VYm
David Walsh Blog
Shoelace 2.0: A Forward-thinking Library of Web Components
A few years ago, I released a lightweight alternative to Bootstrap affectionately named Shoelace. Shoelace was small and fast because of its minimal design and pure CSS approach to styling. It used CSS custom properties extensively to enable customizations…
#techsource #article #davidwalsh
How to Detect When a Sticky Element Gets Pinned
Join Us @techbite @cosmotory
URL: https://bit.ly/3iE9Yne
How to Detect When a Sticky Element Gets Pinned
Join Us @techbite @cosmotory
URL: https://bit.ly/3iE9Yne
David Walsh Blog
How to Detect When a Sticky Element Gets Pinned
We can determine if an element has become sticky thanks to the IntersectionObserver API!
#techsource #article #davidwalsh
Curate Custom Content with mediastack
Join Us @techbite @cosmotory
URL: https://bit.ly/3np5kgc
Curate Custom Content with mediastack
Join Us @techbite @cosmotory
URL: https://bit.ly/3np5kgc
David Walsh Blog
Curate Custom Content with mediastack
I used to have a personal aggregator of sites I enjoyed but maintaining it was a nightmare. I needed to grab each site’s RSS feed, categorize their contents, deal with errors and individual rate limits, etc. I had to tear the whole project down because it…
#techsource #article #davidwalsh
39 Shirts – Leaving Mozilla
Join Us @techbite @cosmotory
URL: https://bit.ly/3izy6Hp
39 Shirts – Leaving Mozilla
Join Us @techbite @cosmotory
URL: https://bit.ly/3izy6Hp
David Walsh Blog
39 Shirts - Leaving Mozilla
In 2001 I had just graduated from a small town high school and headed off to a small town college. I found myself in the quaint computer lab where the substandard computers featured two browsers: Internet Explorer and Mozilla. It was this lab where I fell…
#techsource #article #davidwalsh
How to Conditionally Add Attributes to Objects
Join Us @techbite @cosmotory
URL: https://bit.ly/31cXtJh
How to Conditionally Add Attributes to Objects
Join Us @techbite @cosmotory
URL: https://bit.ly/31cXtJh
David Walsh Blog
How to Conditionally Add Attributes to Objects
JavaScript is full of tricks that you don’t know you want until you … want … them. Or maybe just until you see them. One trick I recently realized was conditionally adding attributes to React elements. Of course this trick essentially boils down to conditionally…
#techsource #article #davidwalsh
How to Prevent Pasting into an Input
Join Us @techbite @cosmotory
URL: https://bit.ly/2HcuQop
How to Prevent Pasting into an Input
Join Us @techbite @cosmotory
URL: https://bit.ly/2HcuQop
David Walsh Blog
How to Prevent Pasting into an Input
Every once in a while I get to a website that doesn’t allow me to paste into a form input. In most cases it’s something to do with login credentials (username and or password) and auth codes. So how are they preventing me from pasting information? It’s as…
#techsource #article #davidwalsh
cookieStore: Async Cookie API
Join Us @techbite @cosmotory
URL: https://bit.ly/3o7mLSU
cookieStore: Async Cookie API
Join Us @techbite @cosmotory
URL: https://bit.ly/3o7mLSU
David Walsh Blog
cookieStore: Async Cookie API
One pattern in the JavaScript API world that web development veterans will notice is that we’ve been creating new methods to accomplish what older, grosser APIs once achieved. XMLHttpRequest became the fetch API, some APIs like Battery became async, and there…
#techsource #article #davidwalsh
Detect Changed Files with git
Join Us @techbite @cosmotory
URL: https://bit.ly/3mfS5NE
Detect Changed Files with git
Join Us @techbite @cosmotory
URL: https://bit.ly/3mfS5NE
David Walsh Blog
Detect Changed Files with git
There are numerous reasons to want to know which files have been added or modified in a git repository, one of which is your text editor highlighting those files. Another use case is running tasks against only files which are presently changed, like lint…
#techsource #article #davidwalsh
How Hacker News Crushed David Walsh Blog
Join Us @techbite @cosmotory
URL: https://bit.ly/3oB20zm
How Hacker News Crushed David Walsh Blog
Join Us @techbite @cosmotory
URL: https://bit.ly/3oB20zm
David Walsh Blog
How Hacker News Crushed David Walsh Blog
Earlier this month, David’s heartfelt posting about leaving Mozilla made the front page of Hacker News. Traffic increased by 800% to his already-busy website, which slowed and eventually failed under the pressure. Request Metrics monitors performance and…
#techsource #article #davidwalsh
Limit Promise Concurrency with pool
Join Us @techbite @cosmotory
URL: https://bit.ly/3kTPU1P
Limit Promise Concurrency with pool
Join Us @techbite @cosmotory
URL: https://bit.ly/3kTPU1P
David Walsh Blog
Limit Promise Concurrency with pool
Methods like Promise.all, Promise.allSettled, Promise.race, and the rest are really excellent for managing multiple Promises, allowing for our apps to embrace async and performance. There are times, however, that limiting the number of concurrent operations…
#techsource #article #davidwalsh
Node isConnected
Join Us @techbite @cosmotory
URL: https://bit.ly/3ptM9Tt
Node isConnected
Join Us @techbite @cosmotory
URL: https://bit.ly/3ptM9Tt
David Walsh Blog
Node isConnected
Every so often I discover a property in JavaScript objects that I didn’t know existed, oftentimes using another trick to accomplish the same functionality. One such property I just learned about was isConnected, a node property that attached to a context…