Here’s a quick snippet to allow you change the HTML of a page before Cypress fires your tests. In an ideal world you would want to have different server side rendered HTML pages and you would just call page-1.html and page-2.html but in my case the component I’m trying to test inherits a configuration from […]
Two years ago I created a small site to track what movies and shows I watch. I did it with Gatbsy because well, it was a new thing for me and I wanted to experiment with Jamstack. The idea is to create a new Markdown file for each movie or tv episode watched. A TV […]
Out of the box doesn’t seem to be possible 🙁 BUT! I’ve found a workaround that works almost as nicely 🎉 There are paid apps out there, but we as developers should do it ourselves 👨🏻💻 To learn from it and to feel like a hacker. 💡 Create a bash script I want to able […]
I was trying to do a querySelector by text, trying to find elements with certain text content of an element. It turns out you can do that with XPath without much effort. With any XPath expression you can think of. Query the elements In my particular use caes, the HTML looks like this: Use your […]
Here’s how to order an array of objects by multiple property values. I want to order my friends: First the oldest. If they have the same age, first the tallest. We’ll use Array.prototype.sort() Result As you can see the friend 4 and 5, who have the same age have been sorted by tallest first.
If you’re debugging a LocalStorage issue and want to use a call stack to know what or who is triggering a localstorage get or set you can define a proxy function. The following snippet will overwrite the window.localStorage It has the same functions but adds a console.log and debugger before them.
Here’s an obvious bit of code (obvious when you know about it) 🤦🏻♂️
How to create a clone of a Vue object without the bindings?