<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Ragnarson - Medium]]></title>
        <description><![CDATA[Posts about Ruby, Ruby on Rails, and software development in general. - Medium]]></description>
        <link>https://medium.com/ragnarson?source=rss----945afaccf91d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Ragnarson - Medium</title>
            <link>https://medium.com/ragnarson?source=rss----945afaccf91d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 14:51:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ragnarson" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Commit Message: How to write clear messages?]]></title>
            <link>https://medium.com/ragnarson/commit-message-how-to-write-clear-messages-0378ca160e45?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/0378ca160e45</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 14:02:27 GMT</pubDate>
            <atom:updated>2023-12-19T14:02:27.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6U8CQ1QxdKGRFH55.png" /></figure><p>As programmers, we often face various challenges, and one of them is naming variables. But have you ever thought about how important proper naming is in the context of commits? Initially, I struggled with this, but thanks to a certain method, my commit messages became more readable and organized. Today, I’ll share this useful tip with you.</p><h3>1. Build: Creating Structure and External Dependencies</h3><p>Introducing changes to the build system or external dependencies can be challenging. Therefore, always label such changes appropriately. For example:</p><pre>git commit -m &quot;build: Updated gulp scripts for better task handling&quot;</pre><h3>2. CI: CI Configuration and Scripts</h3><p>If you make changes to configuration files or CI scripts, remember to label them accordingly. This helps easily identify changes related to continuous integration. Example:</p><pre>git commit -m &quot;ci: Updated Travis scripts to handle new dependency versions&quot;</pre><h3>3. Feat: New Feature</h3><p>New features always require special labelling. This makes it easier to track enhancements in the code. Example:</p><pre>git commit -m &quot;feat: Added the ability to log in with a Google account&quot;</pre><h3>4. Fix: Bug Fixes</h3><p>Every bug fix should be clearly marked. This avoids confusion, and you can quickly identify what has been corrected. Example:</p><pre>git commit -m &quot;fix: Fixed a bug related to incorrect login form display&quot;</pre><h3>5. Docs: Documentation Changes</h3><p>Changes in documentation are as important as changes in code. Label them appropriately to avoid confusion with other types of commits. Example:</p><pre>git commit -m &quot;docs: Updated the user guide for new users&quot;</pre><h3>6. Style: Style and Formatting Changes</h3><p>Changes that affect only style, formatting, or white spaces should be labelled as “style.” Example:</p><pre>git commit -m &quot;style: Fixed indentation in CSS files&quot;</pre><h3>7. Refactor: Non-functional Code Improvements</h3><p>If you make changes that neither fix a bug nor add a feature but improve code quality, use the “refactor” label. Example:</p><pre>git commit -m &quot;refactor: Changed variable names for better readability&quot;</pre><h3>8. Perf: Performance Improvements</h3><p>If you make changes to improve performance, label them as “perf.” Example:</p><pre>git commit -m &quot;perf: Optimized database queries for faster data access&quot;</pre><h3>9. Test: Changes in Tests</h3><p>Adding new tests or improving existing ones should be labelled as a “test.” This helps maintain order in the project structure. Example:</p><pre>git commit -m &quot;test: Added unit tests for the user login handling class&quot;</pre><p>Implementing this commit message convention makes a programmer’s life easier. With proper labelling, both the programmer and other team members can quickly understand what exactly changed in the code. This contributes to a more readable project history and facilitates tracking progress and development.</p><p>It’s worth noting that applying this convention requires discipline and consistency. However, once accustomed to it, the benefits of easier code management are invaluable.</p><p>I encourage all programmers to experiment with this convention in their projects. With it, your repositories will become more transparent, and your work on them will be more organized and efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0378ca160e45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/commit-message-how-to-write-clear-messages-0378ca160e45">Commit Message: How to write clear messages?</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to prepare the application?]]></title>
            <link>https://medium.com/ragnarson/how-to-prepare-the-application-b415908409c2?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/b415908409c2</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 15:06:54 GMT</pubDate>
            <atom:updated>2023-11-21T15:06:53.960Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ra4zlrRHqVQw4M6-.png" /></figure><p>In the dynamic world of frontend programming, ensuring that your project meets the latest standards, adheres to best practices, and offers optimal performance becomes a key challenge for every programmer. This task is particularly demanding, especially when we prioritize not only aesthetics but also functionality and accessibility.</p><p>In this context, a tool like Frontend Checklist.io becomes an invaluable ally for every developer, regardless of their level of experience. In this article, we will explore how to effectively utilize this platform.</p><p>Here are the steps you can take to make the most of Frontend Checklist.io:</p><ol><li><strong>Launch the Tool:</strong><br>Open the official Frontend Checklist.io website by entering <a href="https://frontendchecklist.io/?ref=blog.ragnarson.com">https://frontendchecklist.io/</a> in your web browser.</li><li><strong>Select Language:</strong><br>On the top navigation bar, you’ll find an option to choose your preferred language. Select the language you prefer or want to use for the checklist.</li><li><strong>Browse Sections:</strong><br>Frontend Checklist.io is divided into several sections such as “Meta,” “HTML,” “CSS,” “JavaScript,” “Performance,” “SEO,” etc. Review the available sections and identify those that are relevant to your project.</li><li><strong>Check Checkpoints:</strong><br>In each section, you’ll find checkpoints representing specific tasks or recommendations for that particular area. Check each checkpoint to ensure that your project meets these criteria.</li><li><strong>Set Priorities:</strong><br>Some tasks may be more critical than others depending on the nature of your project. Establish priorities and start with the most essential elements.</li><li><strong>Click on Checkpoint:</strong><br>Clicking on a specific checkpoint will open additional information about that task, including links to educational resources and sources that will help you understand why a particular issue is important.</li><li><strong>Mark Completed Tasks:</strong><br>As you complete tasks, mark them as done by clicking on the checkbox next to each checkpoint.</li><li><strong>Monitor Progress:</strong><br>On the top navigation bar, you’ll find a progress indicator showing how much of the checklist has been completed. This will help you monitor how well the work is progressing toward aligning your project with the standards.</li><li><strong>Repeat the Process:</strong><br>Regularly use Frontend Checklist.io, especially before pushing code to the repository or deploying the project. This tool is dynamic and can be updated, so regular checks ensure that you always have the latest information.</li></ol><p>Frontend Checklist.io is an excellent tool for improving the quality and performance of projects. Remember to customize the checklist according to the specific needs of your project and keep an eye on any changes or updates that may occur in the tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b415908409c2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/how-to-prepare-the-application-b415908409c2">How to prepare the application?</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Utilizing JSON.stringify() method in JavaScript: a guide for Developers]]></title>
            <link>https://medium.com/ragnarson/utilizing-json-stringify-method-in-javascript-a-guide-for-developers-01bf9e272220?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/01bf9e272220</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Wed, 08 Nov 2023 16:02:47 GMT</pubDate>
            <atom:updated>2023-11-08T16:02:47.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7wUJ_fkmj9TzIslB.png" /></figure><p>JavaScript is a widely used programming language for creating interactive web pages and web applications. When working with data in JavaScript, it’s often necessary to convert JavaScript objects to the JSON (JavaScript Object Notation) format and vice versa. In this article, we will discuss one of the most commonly used methods in JavaScript for converting objects to JSON and vice versa — JSON.stringify().</p><h3>What is JSON?</h3><p>JSON, or JavaScript Object Notation, is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. JSON is commonly used for exchanging data between a web server and a web application, serving as an alternative to XML.</p><h3>JSON.stringify() — What is it?</h3><p>JSON.stringify() is a built-in method in JavaScript that converts JavaScript values to JSON format. This method takes an object or a value and returns its JSON representation as a string. It can also be used to transform functions, which are often skipped in the resulting string.</p><h3>JSON.stringify() syntax:</h3><pre>JSON.stringify(value, replacer, space)</pre><ul><li>value: The object or value to convert to JSON.</li><li>replacer (optional): A function that alters the behavior of the stringification process.</li><li>space (optional): A Number or String object that&#39;s used to insert white space into the output JSON string for readability purposes.</li></ul><h3>Examples of Using JSON.stringify():</h3><h3>Converting Object to JSON:</h3><pre>const person = { name: &quot;John&quot;, age: 30, city: &quot;New York&quot; }; const jsonPerson = JSON.stringify(person); console.log(jsonPerson); // Output: &#39;{&quot;name&quot;:&quot;John&quot;,&quot;age&quot;:30,&quot;city&quot;:&quot;New York&quot;}&#39;</pre><h3>Using Replacer Function:</h3><pre>const person = { name: &quot;John&quot;, age: 30, city: &quot;New York&quot; }; const jsonPerson = JSON.stringify(person, (key, value) =&gt; { if (key === &quot;age&quot;) { return value + 5; // Increases age by 5 years } return value; }); console.log(jsonPerson); // Output: &#39;{&quot;name&quot;:&quot;John&quot;,&quot;age&quot;:35,&quot;city&quot;:&quot;New York&quot;}&#39;</pre><h3>Setting Spaces in the Output JSON String:</h3><pre>const person = { name: &quot;John&quot;, age: 30, city: &quot;New York&quot; }; const jsonPerson = JSON.stringify(person, null, 2); console.log(jsonPerson); // Output: // &#39;{ // &quot;name&quot;: &quot;John&quot;, // &quot;age&quot;: 30, // &quot;city&quot;: &quot;New York&quot; // }&#39;</pre><p>The JSON.stringify() method is incredibly useful when you need to send data between a client and a server, as well as when storing data as text in local browser storage. Mastering this method is crucial for any JavaScript developer working with data and wanting to maintain flexibility in manipulating it in their applications. Utilizing JSON.stringify() makes working with JSON data easier and more efficient, enhancing user experiences in web applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01bf9e272220" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/utilizing-json-stringify-method-in-javascript-a-guide-for-developers-01bf9e272220">Utilizing JSON.stringify() method in JavaScript: a guide for Developers</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is console.count() useful for?]]></title>
            <link>https://medium.com/ragnarson/what-is-console-count-useful-for-78aa9c31fdcd?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/78aa9c31fdcd</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Mon, 23 Oct 2023 15:27:14 GMT</pubDate>
            <atom:updated>2023-10-23T15:27:14.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qlidsFs22A2EA1BG.png" /></figure><p>There are times when we really need information about how many times a component has redrawn. In this article, we will learn how to use console.count() to keep track of the number of calls and how it can be useful during application development.</p><h3>What is console.count()?</h3><p>console.count() is a built-in method of the console object in JavaScript that allows us to keep track of how many times it has been called at a given point in our code. When we use console.count(), JavaScript automatically increments the counter for a given key and displays the number of calls in the console.</p><h3>How to use console.count()?</h3><p>The syntax of the console.count() function is simple:</p><pre>console.count([label]);</pre><p>label is an optional argument that allows us to provide a name for our counter. If we specify this argument, console.count() will keep track of the number of calls for a given label. If we do not specify a label, console.count() will keep track of the number of calls for the entire file or for the particular context in which it is called.</p><p><strong>Usage Examples console.count():</strong></p><pre>function someFunction() { console.count(&#39;Wywołanie funkcji&#39;); } someFunction(); // Wywołanie funkcji: 1 someFunction(); // Wywołanie funkcji: 2</pre><pre>for (let i = 0; i &lt; 3; i++) { console.count(&#39;Pętla for&#39;); } // Pętla for: 1 // Pętla for: 2 // Pętla for: 3</pre><ol><li><strong>Tracking Function Calls:</strong><br>Using console.count(), we can easily keep track of how many times our function has been called. This is useful for optimizing code and eliminating unnecessary calls.</li><li><strong>Loop Optimization:</strong><br>For loops, we can check how many times a loop has been executed. If the number is unexpected or too high, we can rethink our algorithm.</li><li><strong>Debugging Complicated Applications</strong>:<br>In large projects where multiple code fragments may call a single function, console.count() allows us to find the exact source of the problem.</li><li><strong>Improving Performance:</strong><br>Tracking the number of calls can help identify pieces of code that need to be optimized, leading to better application performance.</li></ol><h3>Why is console.count() useful?</h3><ol><li><strong>Tracking Function Calls:</strong><br>Using console.count(), we can easily keep track of how many times our function has been called. This is useful for optimizing code and eliminating unnecessary calls.</li><li><strong>Loop Optimization:</strong><br>For loops, we can check how many times a loop has been executed. If the number is unexpected or too high, we can rethink our algorithm.</li><li><strong>Debugging Complicated Applications</strong>:<br>In large projects where multiple code fragments may call a single function, console.count() allows us to find the exact source of the problem.</li><li><strong>Improving Performance:</strong><br>Tracking the number of calls can help identify pieces of code that need to be optimized, leading to better application performance.</li></ol><h3>Summary</h3><p>The console.count() function is a great tool for understanding how our code actually works. It allows us to accurately track function and loop calls, which is crucial for optimizing and debugging our programs. Without a doubt, knowledge of this tool will make it easier for any programmer to analyze and improve his JavaScript code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78aa9c31fdcd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/what-is-console-count-useful-for-78aa9c31fdcd">What is console.count() useful for?</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimize code workflow]]></title>
            <link>https://medium.com/ragnarson/optimize-code-workflow-c7fcaaa3e303?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/c7fcaaa3e303</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 21:38:25 GMT</pubDate>
            <atom:updated>2023-10-09T21:42:32.978Z</atom:updated>
            <content:encoded><![CDATA[<h3>Useful tools for developers: Indent Rainbow &amp; <strong>Fig Extension</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zddqcFFl5iGZ693I2-gKQ.png" /></figure><p>Programming often involves a lot of code, which can make keeping things organized and readable a challenge. There are a variety of tools that can make any programmer’s job significantly easier. In this article, we will discuss two useful tools: the <strong>Indent Rainbow</strong> and the <strong>Fig Extension</strong>.</p><h3>Indent Rainbow: Indent colouring for better readability</h3><p>The first of the useful tools is <strong>Indent Rainbow</strong>. This is an extension that colours indentations in code, which makes reading and navigating large source files much easier. With this tool, you can quickly see where a block of code begins and ends, which increases readability and helps avoid errors due to incorrect indentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*2w8R8OYaV4XUEJxk.png" /></figure><h3>Extension Fig: Visualizing commands in the terminal</h3><p>For those who get lost in the names of branches and consider working with the terminal to be black magic, the <strong>Fig extension</strong> may be the ideal solution. This tool not only lists the branches in the Git version control system but also visualizes the commands in the terminal. Thanks to it, we can easily check the prompts for various commands, or perform a spell check, which greatly speeds up work and increases efficiency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AGDBSUTzHxmdTjan.png" /></figure><h3>Summary</h3><p>Managing large software projects can be a challenge, but with the right tools, you can minimize stress and increase productivity. <strong>Indent Rainbow</strong> and <strong>Fig Extension</strong> are just two examples among the many tools available to programmers. Their use can significantly improve code quality, speed up work and make the programming process much more enjoyable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7fcaaa3e303" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/optimize-code-workflow-c7fcaaa3e303">Optimize code workflow</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript: a Generator]]></title>
            <link>https://medium.com/ragnarson/javascript-a-generator-67a668e2c1dc?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/67a668e2c1dc</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 12:46:03 GMT</pubDate>
            <atom:updated>2023-09-05T12:46:03.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QWfURbFWkl9O7cCF.png" /></figure><p>JavaScript generators are a powerful tool that often remains underestimated. And while most tasks can now be solved with async/await, today I’ll show you how to use a JavaScript generator to create a unique ID generator.</p><h3>Creating an ID Generator</h3><p>First, let’s create a function genId. To begin with, we do not need to pass any arguments to it.</p><pre>function genId() { let id = 0; id++; }</pre><p>However, if we now call this function, we will get undefined, because our function does not return anything. To turn it into a generator, we need to add an asterisk (*) after the word function in the function declaration.</p><pre>function* genId() { let id = 0; id++; }</pre><p>Let’s assign our generator to a variable:</p><pre>const gen = genId();</pre><p>Now we can use our generator. The next method is available, which allows us to get values from the generator in steps.</p><pre>console.log(gen.next()); // { value: undefined, done: true }</pre><p>The next method returned us an object that has a value ( value), which is undefined, and done, which is true. This is because inside the code of our function there is no moment when we would return something. To stop the generator and return a value, we need to use the yield keyword.</p><pre>function* genId() { let id = 0; yield id++; }</pre><p>Now everything has changed.</p><pre>console.log(gen.next()); // { value: 0, done: false }</pre><p>The function did not reach the end because it stopped on the word yield. We can now copy this fragment several times:</p><pre>function* genId() { let id = 0; yield id++; yield id++; yield id++; } console.log(gen.next()); // { value: 0, done: false } console.log(gen.next()); // { value: 1, done: false } console.log(gen.next()); // { value: 2, done: false }</pre><h3>ID Generator Using Loops</h3><p>But that’s not all. We can also create an ID generator using a while loop that will run indefinitely until we stop it.</p><pre>function* genId() { let id = 0; while (true) { yield id++; } }</pre><p>Now our generator will provide unique identifiers indefinitely, thanks to the use of the true condition.</p><p>Generators in JavaScript are tools that are worth knowing and using. They are useful for handling asynchronous operations, generating data sequences and many other applications. I hope this article has helped you understand how to create and use ID generators in JavaScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67a668e2c1dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/javascript-a-generator-67a668e2c1dc">JavaScript: a Generator</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to Use ‘never’ vs ‘void’ in Your TypeScript Functions]]></title>
            <link>https://medium.com/ragnarson/when-to-use-never-vs-void-in-your-typescript-functions-c20fc44b847?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/c20fc44b847</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Tue, 22 Aug 2023 10:44:28 GMT</pubDate>
            <atom:updated>2023-08-22T10:44:28.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50CCNf7abWDdrnpKamocvA.png" /></figure><p>When working with TypeScript, developers may come across the terms “never” and “void” while defining function return types. Both types signify the absence of a return value, but subtle differences exist between them.</p><p>“Void” is a type that represents the absence of a value returned by a function. It means that the function will execute but not return any data. It is useful when we want to perform some side-effect, like logging a message or updating a database, without returning any data.</p><p>On the other hand, “never” is a type that represents a function that will never return. It means the function will throw an error or enter into an infinite loop. It is useful when we want to signal that a function will never complete normally.</p><p>Consider the following examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*WS1Bxu5MCQg3WDhNgdqq_A.png" /></figure><p>In the example above, logMessage is a function that logs a message to the console and returns nothing, so its return type is void. throwError is a function that throws an error, so its return type is never. Finally, infiniteLoop is a function that enters into an infinite loop and never returns, so its return type is also never.</p><p>In summary, “void” is used when a function performs a side-effect and does not return any data, while “never” is used when a function will never complete normally. Understanding the differences between these types is important to use them correctly in your TypeScript code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYHtRDyooiY5ABwkhPZpWw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c20fc44b847" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/when-to-use-never-vs-void-in-your-typescript-functions-c20fc44b847">When to Use ‘never’ vs ‘void’ in Your TypeScript Functions</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Converting {} object to [] arrays]]></title>
            <link>https://medium.com/ragnarson/converting-object-to-arrays-13c1b535285f?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/13c1b535285f</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Tue, 22 Aug 2023 10:35:59 GMT</pubDate>
            <atom:updated>2023-08-22T10:35:59.270Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GRiug-FDTGmykWJR.png" /></figure><p>In JavaScript, we often find the need to extract keys, values or pairs of them from an object. There are various approaches to this task, including the use of <strong>for…in</strong> loops and methods associated with the <strong>Object</strong> option. In this article, we will discuss both of these methods and compare their functionality.</p><h3>Loop “for…in” — traditional view</h3><p>The first way to pull keys, values or key-value pairs from an object is to use the <em>for…in</em> a loop. Below is an example of using this loop to pull keys from an object:</p><pre>const user = { name: &quot;John&quot;, age: 30, email: &quot;john@example.com&quot; }; for (let key in user) { console.log(key); }</pre><p>In the above code, we iterate through each key in the “user” object using a <em>for…in</em> loop. For each key, we display it in the console. As a result, we get the following result:</p><pre>name age email</pre><p>This is a traditional approach that can be useful in some situations. However, there is a more modern solution, which offers the Object option.</p><p>The <strong>Object</strong> provides us with three useful methods for extracting keys, values and key-value pairs from an object: <em>Object.keys(), Object.values() </em>and<em> Object.entries()</em>. Below are examples of their use:</p><h3>Key extraction with Object.keys()</h3><pre>const user = { name: &quot;John&quot;, age: 30, email: &quot;john@example.com&quot; }; const userKeys = Object.keys(user); console.log(userKeys);</pre><p>The code above uses the<em> Object.keys()</em> method, which returns an array containing all the keys from the “user” object. The result is the following array: [&quot;name&quot;, &quot;age&quot;, &quot;email&quot;].</p><h3>Extracting values using Object.values()</h3><pre>const user = { name: &quot;John&quot;, age: 30, email: &quot;john@example.com&quot; }; const userValues = Object.values(user); console.log(userValues);</pre><p>The <em>Object.values()</em> method allows us to get an array containing all the values from the “user” object. The result of this code will look like this: [&quot;John&quot;, 30, &quot;john@example.com&quot;].</p><h3>Extracting key-value pairs using Object.entries()</h3><pre>const user = { name: &quot;John&quot;, age: 30, email: &quot;john@example.com&quot; }; const userKeysValues = Object.entries(user); console.log(userKeysValues)</pre><p>If you use the <em>Object.entries()</em> method, you will get an array that contains key-value pairs for each element of the “user” object. The result will look as follows:</p><pre>[ [&quot;name&quot;, &quot;John&quot;], [&quot;age&quot;, 30], [&quot;email&quot;, &quot;john@example.com&quot;] ]</pre><h3>Summary</h3><p>Extracting keys, values and key-value pairs from an object in JavaScript can be accomplished in several ways. The traditional approach is to use a “for…in” loop, whose task is to iterate through the object’s keys. However, a better approach is to use methods associated with the <em>Object object. Object.keys(), Object.values() </em>and<em> Object.entries()</em> methods allow us to quickly and conveniently get keys, values or key-value pairs from an object. They make our code more readable and easier to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTTZA_R5xPdFZlk_q9lKGQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13c1b535285f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/converting-object-to-arrays-13c1b535285f">Converting {} object to [] arrays</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to accelerate your code work?]]></title>
            <link>https://medium.com/ragnarson/how-to-accelerate-your-code-work-e75e5c96b1e3?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/e75e5c96b1e3</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 11:40:18 GMT</pubDate>
            <atom:updated>2023-08-16T11:40:18.711Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JCkJhO7KhpFAldzI.png" /></figure><p>Tools that support the software development process play a fundamental role in the development and convenience of daily programming work. In this article, we will review two tools: Save Code and Template String Converter.</p><h3>Save Code — the most commonly used scripts at hand</h3><p>Save Code is an extension that can make it much easier to store, organize and use frequently used code snippets between projects. Have you happened to write a script that you find extremely useful and would like to use in other repositories without having to rewrite it from scratch? You’ll do it with Save Code.</p><h3>How does Save Code work?</h3><p>With the extension, we can save the scripts we use most often and use them between different repositories. It is a personal library of code snippets that can easily access and use in any project. This process saves time and effort by eliminating the need to search through previous projects for the same or similar solutions.</p><h3>Review your snippets easily</h3><p>Once we save our scripts using Save Code, we can browse through them easily using a custsom command. In most development environments where we are used to using keyboard shortcuts, we can use command+shift+f8 (or Windows/Linux equivalent) and we will get to our snippets.</p><h3>Template String Converter — easy string interpolation</h3><p>Another tool worth exploring is Template String Converter. With this small extension, you can interpolate strings effortlessly in the code editor. Did you happen to work with long strings, in which it was necessary to use a number of quotes and concatenation operators? Template String Converter can significantly simplify this process.</p><h3>How does the Template String Converter function?</h3><p>When you want to use string interpolation in the code editor, instead of the traditional quotation marks and concatenation operators, just use ${}. This is where Template String Converter comes into action. After typing the ${} character, the editor automatically converts a regular string into a <em>backtick</em> (` character). Inside the backtick we can place our variables, using the ${variable_name} notation. The result is more readable and easier to maintain code.</p><p>Here is a simple example of how to use the tool:</p><p>const name = &#39;John&#39;; const age = 30; const message = `Cześć, nazywam się ${name} i mam ${age} lat.`; console.log(message);</p><p>In the example above, we use Template String Converter to interpolate the name and age variables into a messagestring. Instead of concatenating the strings using the + operator, we can conveniently place the variables inside the backtick and tag them with ${}.</p><p>With Template String Converter, we can increase the readability and conciseness of our code, which translates into more convenient work and less chance of making a mistake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ul4NOXDoxG_FjKTwtj4TKg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e75e5c96b1e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/how-to-accelerate-your-code-work-e75e5c96b1e3">How to accelerate your code work?</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Displaying Code Results in Editor: Essential Tools]]></title>
            <link>https://medium.com/ragnarson/displaying-code-results-in-editor-essential-tools-d0fe662b8d21?source=rss----945afaccf91d---4</link>
            <guid isPermaLink="false">https://medium.com/p/d0fe662b8d21</guid>
            <dc:creator><![CDATA[Sebastian Ścigała]]></dc:creator>
            <pubDate>Thu, 10 Aug 2023 12:04:28 GMT</pubDate>
            <atom:updated>2023-08-16T11:41:12.538Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4hqUZCeR5SgTIN2N.png" /></figure><p>With the rapid pace of web programming, developers need tools that streamline their work and increase productivity. One such tool gaining popularity in the JavaScript community is <strong>Quokka.js</strong> and <strong>Console Ninja</strong>.</p><p><strong>Quokka.js</strong> is a live notepad that allows developers to test code instantly and see the results in real-time. Quokka.js provides immediate feedback by displaying the results alongside the code.<br>Using the tool eliminates the need for console.log statements or breakpoints. This real-time code evaluation capability allows you to quickly iterate and experiment with your code, making it easier to detect bugs and understand how different parts of your code work together.</p><p><strong>Console Ninja</strong> — an advanced tool that offers several advanced features and techniques. These will allow you to better understand and efficiently debug your code.</p><p>One of the most essential features of Console Ninja is the ability to display interactive tables, graphs, and diagrams to help you analyze and visualize your data. You can quickly see the structure of objects, tables, and other data structures in a more readable, and transparent form. In addition, with the ability to sort, filter and group data, Console Ninja allows you to examine and analyze information more quickly and accurately.</p><p>Another very powerful feature of Console Ninja is its ability to track function calls and analyze the call stack. You can easily see which functions are called while your code is running and what the return values are.</p><p>Console Ninja also offers the ability to define different levels of logs. This allows you to customize which information you want to log and which you wish to omit. You can also add custom messages and metadata to better understand the context in which errors occur.</p><p>Quokka.js is useful for prototyping and working on a single file. Console Ninja is a much more powerful tool that works on an entire project. The following example illustrates the use of Console Ninja directly in code.</p><pre>@Controller() export class AppController { constructor(private readonly appService: AppService) {} private i = 0 @Get(&#39;/&#39;) getHello(): string { this.i++ console.log(&quot;Request number: ${this.i}`) return this.appService.getHello() } @Get(&#39;/name/:name&#39;) getName(@Param(&#39;name&#39;) name: string, @Req() request: Request): string { const text = `Requested name: [{name}` console.log({ name, resp: text, method: request.method }) return text } }</pre><p>When you use Console Ninja on the line:</p><pre>console.log({ name, resp: text, method: request.method })</pre><p>will show us when the task was completed and what was returned:</p><pre>[17:11:18.454] { name: &#39;pimpek&#39;, resp: &#39;Requested name: pimpek&#39;, method: &#39;GET&#39; }</pre><p>If the Console Log has been executed several times, all executions with a time signature are displayed. If you click the <em>Show in Console Output </em>link, you gain access to the full logs in a separate window.</p><pre>[17:11:18.454] { name: &#39;pimpek&#39;, resp: &#39;Requested name: pimpek&#39;, method: &#39;GET&#39; } [17:12:14.544] { name: &#39;pimpek&#39;, resp: &#39;Requested name: pimpek&#39;, method: &#39;GET&#39; } [17:13:11.754] { name: &#39;pimpek&#39;, resp: &#39;Requested name: pimpek&#39;, method: &#39;GET&#39; }</pre><p>If you use Console Ninja in your console, next to the logs, you will find references to specific places in the code where the Console Log was executed.</p><p>The combination of Quokka.js and Console Ninja allows you to eliminate time-consuming tasks and focus on solving problems. Whether you are a novice programmer or a seasoned expert, the use of these tools benefits both when creating new projects and when analyzing and improving existing code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czmHp3-4mEesehkwt1yRYw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0fe662b8d21" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ragnarson/displaying-code-results-in-editor-essential-tools-d0fe662b8d21">Displaying Code Results in Editor: Essential Tools</a> was originally published in <a href="https://medium.com/ragnarson">Ragnarson</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>