How to copy rich text using ClipboardJS in Svelte
In my side project using Svelte I needed to copy rich text, including images and formatted text. Turns out this seemingly simple task is rather difficult and is done using different APIs for different browsers. Nothing to worry about, though - there must be an NPM package for it! This package is ClipboardJS, but if you read the docs they recommend including it as a script in your header either from CDN or from your dist folder....
Better and cleaner assertions using snapshots
Assertions are a crucial part of tests. Even though most developers realize this, they often are rather limited. After all, they can be cumbersome to write. For example, if you’re running E2E tests for an endpoint that returns a list of 10 elements with 10 properties each - which isn’t even near the amount of data that often flows through production systems - you already have to write assertions for 100 properties....
The problem with measuring the performance of single-page apps
The performance of web pages and applications is crucial for a variety of reasons. Maybe you can simply see your app is slow, or you’ve heard that performance is important for SEO. It could be you’re concerned about the experience of your users, of which more than half are going to leave your site if it’s too slow or that you’ve got some non-functional requirements that you have to meet. Whatever the reason for your curiosity, you will likely find a lot of articles about Web Vitals....
Testing the integration with a database the right way - introduction to Testcontainers
Persisting data in a database is one of the most common tasks that applications have to perform, and it’s so crucial that without it the rest of the app is often useless. It’s also an area that’s notoriously hard to test. In this blog post, you can read about several ways of doing it and some problems they come with. Finally, I’m going to share with you how I use Testcontainers to test the integration with a database and why I think it’s the best way to do it....
More readable Entity Framework Core queries with LINQKit
Recently I’ve completed a task that required writing a complex query in Entity Framework Core. After completing said tasked I’ve decided to marvel at my creation and saw, that there’s not much to marvel at - it did the job, but it wasn’t very readable. I already felt pity for the poor soul that has to understand it, or even worse, modify it - especially because more than likely it’d be me, after I’ve long forgotten the monstrosity I created....