@ -40,7 +40,7 @@ const regexp = /\s+/g;
|
||||
|
||||
### Match line breaks
|
||||
|
||||
- Depending on the environnment, line breaks can be represented in different ways.
|
||||
- Depending on the environment, line breaks can be represented in different ways.
|
||||
- Use the `\r` character to match carriage returns, the `\n` character to match newlines, and the `\r\n` sequence to match carriage returns followed by newlines.
|
||||
- Add the global (`g`) and multiline (`m`) flags to match all occurrences of the pattern in the string.
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ excerpt: A short summary of your story up to 180 characters long.
|
||||
firstSeen: 2022-11-23T05:00:00-04:00
|
||||
---
|
||||
|
||||
When styling injected or generated HTML content, you might not have access to the classes or IDs of the elements you want to style. This can become especially annoying when dealing with link elements. Luckily, you can use the `:not()` selector with an appropriate attribute selector to check for the abscence of a class and style links accordingly.
|
||||
When styling injected or generated HTML content, you might not have access to the classes or IDs of the elements you want to style. This can become especially annoying when dealing with link elements. Luckily, you can use the `:not()` selector with an appropriate attribute selector to check for the absence of a class and style links accordingly.
|
||||
|
||||
```css
|
||||
a[href]:not([class]) {
|
||||
|
||||
@ -16,7 +16,7 @@ Figuring out where an element is located on the page with JavaScript can be tric
|
||||
As I recently discovered, `Document.elementFromPoint()` provides a pretty interesting and straightforward solution. It allows you to get the element at a specific point on the page and it also works quite well with `iframe`s, too. Additionally, `Document.elementsFromPoint()` provides similar functionality, but returns an array of all the elements at a specific point on the page, in order of their z-index.
|
||||
|
||||
```js
|
||||
// Returns the topmost element at the speicifed coordinates
|
||||
// Returns the topmost element at the specified coordinates
|
||||
const element = document.elementFromPoint(x, y);
|
||||
|
||||
// Returns an array of all the elements at the specified coordinates
|
||||
|
||||
@ -16,7 +16,7 @@ Theoretically, email addresses can be validated using a regular expression. Afte
|
||||
|
||||
Additionally, even if you could validate an email address, there’s **no way of knowing if this address is in fact currently in use**. The only way to do so, is to send an email and check the response. This is why most websites and apps nowadays send you a confirmation email in the first place.
|
||||
|
||||
Finally, even if you used a regular expression that is compliant with RFC 2822, it wouldn’t be without issues. Understading how it works or figuring out if it works correctly for each and every case would be pretty difficult. More importantly, though, it could be prone to **regular expression denial of service (ReDoS) attacks**, if implemented incorrectly.
|
||||
Finally, even if you used a regular expression that is compliant with RFC 2822, it wouldn’t be without issues. Understanding how it works or figuring out if it works correctly for each and every case would be pretty difficult. More importantly, though, it could be prone to **regular expression denial of service (ReDoS) attacks**, if implemented incorrectly.
|
||||
|
||||
By now, you should be starting to figure out why I’ve been hesitant to showcase a solution to the problem of email validation. While solutions do exist, the implications of each one must be considered carefully.
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class FrequencyMap extends Map {
|
||||
- Define an `add()` method, which will take a value and increment its count in the data structure. Use `Map.prototype.has()` to check if the value already exists and act accordingly.
|
||||
- Extend `Map.prototype.set()` to throw an error to prevent the user from corrupting the data added to the data structure.
|
||||
- Extend `Map.prototype.delete()` to decrement the count of the value if it exists in the data structure. Use `Map.prototype.has()` to check if the value's frequency is `1` and delete it if necessary.
|
||||
- As the data structure operates more like a `Set`, ater the `constructor` to accept an array of values. Use `Array.prototype.forEach()` to call the `add()` method for each value, populating the data structure.
|
||||
- As the data structure operates more like a `Set`, after the `constructor` to accept an array of values. Use `Array.prototype.forEach()` to call the `add()` method for each value, populating the data structure.
|
||||
- Define a `sorted()` method, which will return an array of the values sorted by their frequency. Use `Array.prototype.sort()` to sort the values by their frequency and `Array.prototype.map()` to return only the values. The `ascending` argument determines the order of the returned array.
|
||||
|
||||
```js
|
||||
|
||||
@ -24,4 +24,4 @@ Apart from engine-related delays, there are a few other factors that play a role
|
||||
- Timeouts and intervals in **inactive/background tabs are throttled** to a minimum of 1000ms to increase battery life.
|
||||
- **Known tracking scripts in background tabs** can be throttled even further after a certain amount of time.
|
||||
|
||||
On a side note, some browsers store delays as a 32-bit signed integer, meaning that delays over 24.8 days will cause an overflow an dexecute immediately.
|
||||
On a side note, some browsers store delays as a 32-bit signed integer, meaning that delays over 24.8 days will cause an overflow and execute immediately.
|
||||
|
||||
@ -5,7 +5,7 @@ tags: career,webdev,programming,management
|
||||
expertise: intermediate
|
||||
author: chalarangelo
|
||||
cover: blog_images/new-york.jpg
|
||||
excerpt: Leanr what technical debt is, its causes and symptoms, and how to deal with it.
|
||||
excerpt: Learn what technical debt is, its causes and symptoms, and how to deal with it.
|
||||
firstSeen: 2022-10-09T05:00:00-04:00
|
||||
---
|
||||
|
||||
@ -47,4 +47,4 @@ After getting to a manageable level, it's important to **keep technical debt in
|
||||
|
||||
### Conclusion
|
||||
|
||||
Technical debt is a natural, unavoidable part of software development. Miscommunication and lack of understanding can lead to it, resulting in lowered velocity and morale. Luckily, a bit of awereness, good communication and an actionable process can help reduce it and keep it in check.
|
||||
Technical debt is a natural, unavoidable part of software development. Miscommunication and lack of understanding can lead to it, resulting in lowered velocity and morale. Luckily, a bit of awareness, good communication and an actionable process can help reduce it and keep it in check.
|
||||
|
||||
Reference in New Issue
Block a user