Code
-
Script setup Vue 3 – ❮Script lang=”ts” setup❯
Script setup <Script lang=”ts” setup> is something i really appreciate after migrating from vue 2. It is a part of the new Script Setup feature introduced in Vue 3. It replaces the traditional <script> block and provides a more concise and focused way to write components. The purpose of <script setup> is to simplify component code by removing unnecessary boilerplate and reducing redundancy. What Does It Do? The code inside <script setup> is compiled as the content of the component’s setup() function. You can remember it from vue 2 for both, composition and options api.Unlike the normal <script> block, which executed only once when the component is first imported, code…
-
Effective Programming in Scala course by Coursera. Simple review.
Effective Programming in Scala course by Coursera is one of the official learning paths, described on https://www.scala-lang.org/, one can take to learn and dive into scala language. The main outcome is that You should definetly try it but there is always some „but”. Main things to do Lectures During the course You will watch short and very neat and straight down to the point lectures. This is always a given in every course. If i remember my long hours and the university i wonder how did i endure all that and why everything was so convoluted. Here we get everything short and sweet. Coursera time frame Somethimes it might feel…
-
Vite findByText to get all the elements
Vite findByText method could help us a lot, especially while testing any kind of i18n and similar. Of course we should always get the proepr component / element but such methods are very usefull when developing and debugging, later we can scrape it all. Later, when we know it works as we expect it. FindByText method can be especially usefull when we have a big flat table that may or may not be dynamically populated. Works great as a function to watch the vaues beeing present in the dom so we can catch the proper moment. Altough we could use the debugger, i find that printing a lot of stuff…
-
How to wait for a reactive vue component like tooltip ?
How to wait for a reactive vue component like tooltip ? That`s a tricky one, especially while everything is rendered dynamically and we really need to know where to look… or how to wait… Testing asynchronouse components Vite waitFor Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out. Vite waitUntil This is similar to vi.waitFor, but if the callback throws any errors, execution is immediately interrupted and an error message is received. If the callback returns falsy value, the next check will continue until truthy value is returned. This is useful…
-
!! operator in vue components
!! operator (double negation) transforms values into boolean values. This ’!!’ operator converts any value to TRUE if it’s „truthy„, meaning it’s not a falsy value (such as false, 0, empty value, null, undefined, NaN), otherwise it converts to FALSE. !! operator examples : For example, if you have a variable myVar, and you want to check if it’s „truthy” or „falsy”, you can do it using the !! operator like this: Another example is when the !! operator helps to validate any optional variables. Somethimes we really have no idea what we will get, this can vent some issues if we need to check for a truthy or falsy…
-
Locality of Behaviour
Locality of Behaviour is a great principle that should help with maintaining the code. This is the characteristic of the code that enables a developer to only read a small portion of code to understand its function. Without the need to skip, skim, read, jump all over multiple files. I love that rule cause it DOES MAKE SENSE. I can see many places where we would benefit from it but not always do it that way because of the 'standard’. Which, in the end, nobody knows what it is anymore cause everyone is mixing patterns, antipatterns and the number one performance metric is how fast you can deliver… maybe i…
-
Scala pipe operator „|>”
Scala pipe operator „|>” passes the result of the left side to the right side method/function as the first argument. t is, one might argue, „yet another arrow”, that provides „something” to be put „somewhere”. This is absolutely true but in addition it provides readability. Scala pipe operator „|>” source code It is just a simple fancy looking generic function : IThis operator shines if Your code at least tries to follow rules written down by Uncle Bobo and his clean code mentality. This allows you to chain function calls in a more natural left-to-right order, which can sometimes be more readable than nested function calls. Just don`t get overboard…
-
How to set empty array in dijon using scala
There is a simple method that allows to set empty array in dijon and You will not find it on the main page of dijon repository. dijon.`[]` This is actually a byte array in the end. Oh… and remember that jsoniter will by default remove the empty variables on any kind of DTO when serializing …