<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>dev notes</title>
    <link>https://juhanakristianblog.netlify.app/</link>
    <description>Recent content on dev notes</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 19 Jan 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://juhanakristianblog.netlify.app/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>I built a Lily58 split keyboard</title>
      <link>https://juhanakristianblog.netlify.app/posts/i-built-a-lily58-split-keyboard/</link>
      <pubDate>Sun, 19 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/i-built-a-lily58-split-keyboard/</guid>
      <description>&lt;p&gt;So about a month ago I took the plunge into the DIY keyboard space and ordered a split keyboard kit called Lily58 kit from keebd.com. In this post I&amp;rsquo;m going to go over the parts, building process and my current thoughts on the keyboard.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://juhanakristianblog.netlify.app/images/lily58_finished.jpeg&#34; alt=&#34;Finished Lily58 keyboard&#34;&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-parts&#34;&gt;The parts&lt;/h3&gt;&#xA;&lt;p&gt;There are a few stores selling the Lily58 kit but I ordered mine from keebd.com. The price for the kit was 55.95€ before taxes. Keebd.com is located in Australia and I&amp;rsquo;m in the EU so I of course had to pay customs and taxes on top of that. Total for the kit shipped to Finland was about 110€.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What I really want from AI</title>
      <link>https://juhanakristianblog.netlify.app/posts/what-i-really-want-from-ai/</link>
      <pubDate>Sun, 22 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/what-i-really-want-from-ai/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been using GitHub Copilot since it became available in the technical preview in 2021. During this time the field of AI developer tools has changed dramatically. Now we have many alternatives to Copilot such as Cursor, Windsurf and Aider. The tools have not only improved the autocomplete suggestions developers get but also changed the workflow of developers using them. Cursor specifically was the first tool I felt was a major step forward in using AI as coding assistant. It seemed to understand the context and the project I was working on much better than Copilot and was able to make large changes spanning multiple files. Recently GitHub has added to Copilot the support for editing multiple files and providing a larger context for the LLM to work with similarly to what Cursor does. It seems to work reasonably well in most cases even if I have to make some changes to the results to make them usable. I think this is already a huge step forward from the initial Copilot versions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Dynamic aggregation fields in Django</title>
      <link>https://juhanakristianblog.netlify.app/posts/dynamic-aggregation-fields-in-django/</link>
      <pubDate>Tue, 05 Sep 2023 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/dynamic-aggregation-fields-in-django/</guid>
      <description>&lt;p&gt;In this article I will walk you through on how to create dynamic aggregation in Django. By dynamic aggregation I refer to the ability to define the resulting aggregation fields programmatically.&lt;/p&gt;&#xA;&lt;p&gt;Aggregation is a powerful tool when working with data in Django. With it you can have your database summarize or convert data into the format you need.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s an example of a basic &lt;code&gt;Sum&lt;/code&gt; aggregation.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; django.db &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; models&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; django.db.models &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Sum&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Order&lt;/span&gt;(models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Model):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    total_price &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;DecimalField(max_digits&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;, decimal_places&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Calculate the total sum of all order prices&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;total_sum &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Order&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;objects&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;aggregate(total&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Sum(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;total_price&amp;#39;&lt;/span&gt;))[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;total&amp;#39;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Total sum of all order prices: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;total_sum&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We have a &lt;code&gt;Order&lt;/code&gt; model with total price. If we want the total sum in some collection of orders (all orders in the example), we can use &lt;code&gt;aggregate&lt;/code&gt; with &lt;code&gt;Sum&lt;/code&gt; .&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to search files from Azure Blob Storage using Python</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-search-files-from-azure-blob-storage-using-python/</link>
      <pubDate>Tue, 13 Dec 2022 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-search-files-from-azure-blob-storage-using-python/</guid>
      <description>&lt;p&gt;Searching for files using &lt;a href=&#34;https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-index-how-to?tabs=azure-portal&#34;&gt;index tags&lt;/a&gt; is a common use case but the Azure documentation can be quite hard to grasp.&lt;/p&gt;&#xA;&lt;p&gt;To search for blobs with specific tags in Azure Blob Storage using Python, you can use the &lt;code&gt;find_blobs_by_tags&lt;/code&gt; method from the Azure Storage SDK. It takes as a single parameter &lt;code&gt;filter_expression&lt;/code&gt; which can be used to query blobs with specific tags, container or name.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s an example of how to use &lt;code&gt;find_blobs_by_tags&lt;/code&gt; to search for blobs with specific tags&lt;/p&gt;</description>
    </item>
    <item>
      <title>What are template literal types in TypeScript?</title>
      <link>https://juhanakristianblog.netlify.app/posts/what-are-template-literal-types-in-typescript/</link>
      <pubDate>Thu, 21 Apr 2022 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/what-are-template-literal-types-in-typescript/</guid>
      <description>&lt;p&gt;Before diving into template literal types, we first need to discuss &lt;a href=&#34;https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types&#34;&gt;string literal types&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In TypeScript, string literal types are types that constrain the type of a variable to a string or a union of strings.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;type&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Greeting&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello world&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;text1&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;Greeting&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello world&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#75715e&#34;&gt;// ✅  This is ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;text2&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;Greeting&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#75715e&#34;&gt;// ❌ Type &amp;#39;&amp;#34;hello&amp;#34;&amp;#39; is not assignable to type &amp;#39;&amp;#34;hello world&amp;#34;&amp;#39;.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Constraining the value of a variable to a single string is not that useful but a union of strings is something you&amp;rsquo;ll see often.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to implement useMediaQuery hook in React</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-implement-usemediaquery-hook-in-react/</link>
      <pubDate>Sun, 13 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-implement-usemediaquery-hook-in-react/</guid>
      <description>&lt;h3 id=&#34;what-are-media-queries&#34;&gt;What are Media Queries?&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries&#34;&gt;Media Queries&lt;/a&gt; are a CSS feature that can be used to conditionally apply selected styles on an HTML element. Some examples of media queries include checking for the width of the browser window, checking for the media type (print, screen), or checking for dark/light mode preference.&lt;/p&gt;&#xA;&lt;p&gt;The most common use case for media queries is using it to implement responsivity on a website. Checking for the width of the viewport and applying styles based on it allows us to define different styles on different devices (desktop, mobile, tablet).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Basics of React server-side rendering with Express.js</title>
      <link>https://juhanakristianblog.netlify.app/posts/basics-of-react-server-side-rendering-with-express-js/</link>
      <pubDate>Sat, 05 Feb 2022 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/basics-of-react-server-side-rendering-with-express-js/</guid>
      <description>&lt;p&gt;If you want to develop SEO friendly and fast websites with React, you have two choices: server-side rendering (SSR) or static site generation (SSG).&lt;/p&gt;&#xA;&lt;p&gt;There are some awesome frameworks like &lt;a href=&#34;https://remix.run/&#34;&gt;remix.run&lt;/a&gt; , &lt;a href=&#34;https://nextjs.org/&#34;&gt;next.js&lt;/a&gt;, &lt;a href=&#34;https://astro.build/&#34;&gt;astro&lt;/a&gt; or &lt;a href=&#34;https://www.11ty.dev/&#34;&gt;11ty&lt;/a&gt;, which allow you to use one of (or both) techniques. So if you&amp;rsquo;re building a production app, I recommend using one of them because server-side rendering is quite hard to get right.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But&lt;/strong&gt; if you want to understand how it works and what is happening under the hood in these frameworks, you definately should try it out. This article will focus on how SSR works and we will also go through a simple example of using SSR.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Use Model Manager to filter queryset by default</title>
      <link>https://juhanakristianblog.netlify.app/posts/use-model-manager-to-filter-queryset-by-default/</link>
      <pubDate>Tue, 18 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/use-model-manager-to-filter-queryset-by-default/</guid>
      <description>&lt;p&gt;How can you filter a queryset by default so that no matter where you use the model, the filter will be applied?&lt;/p&gt;&#xA;&lt;p&gt;This can be achieved by creating a custom &lt;a href=&#34;https://docs.djangoproject.com/en/4.0/topics/db/managers/&#34;&gt;Manager&lt;/a&gt; and overriding its &lt;code&gt;get_queryset&lt;/code&gt; method.&lt;/p&gt;&#xA;&lt;p&gt;For example, if we have a &lt;strong&gt;soft delete&lt;/strong&gt; feature in our app implemented by adding a &lt;code&gt;deleted&lt;/code&gt; column, we can force only returing non-deleted objects by creating a custom model manager which filters for &lt;code&gt;deleted=false&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Should you use React.FC to type your components?</title>
      <link>https://juhanakristianblog.netlify.app/posts/should-you-use-reactfc-to-type-your-components/</link>
      <pubDate>Tue, 07 Dec 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/should-you-use-reactfc-to-type-your-components/</guid>
      <description>&lt;p&gt;&lt;strong&gt;TLDR:&lt;/strong&gt; &lt;a href=&#34;https://github.com/facebook/create-react-app/pull/8177&#34;&gt;No&lt;/a&gt;. &lt;a href=&#34;https://github.com/typescript-cheatsheets/react#function-components&#34;&gt;You&lt;/a&gt; &lt;a href=&#34;https://kentcdodds.com/blog/how-to-write-a-react-component-in-typescript&#34;&gt;should&lt;/a&gt; probably &lt;a href=&#34;https://twitter.com/nickemccurdy/status/1365384372908621833&#34;&gt;not&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Dialog&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;React.FC&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; ({&lt;span style=&#34;color:#a6e22e&#34;&gt;children&lt;/span&gt;}) &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;...&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The consensus in the React community now seems to be that, you should avoid using &lt;code&gt;React.FC&lt;/code&gt; because it causes the component to implicitly take &lt;code&gt;children&lt;/code&gt;. This means the component will accept children, even if they&amp;rsquo;re not supposed to.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a look at the pros and cons of &lt;code&gt;React.FC&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;pros-of-reactfc&#34;&gt;Pros of React.FC&lt;/h2&gt;&#xA;&lt;h3 id=&#34;excplicit-return-type&#34;&gt;Excplicit return type&lt;/h3&gt;&#xA;&lt;p&gt;In addition to the &lt;code&gt;children&lt;/code&gt; prop, &lt;code&gt;React.FC&lt;/code&gt; declares an explicit return type for the component. The return type is &lt;code&gt;ReactElement | null;&lt;/code&gt; and we will get a type error if we try to return something else from the component.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why you should use the URL to store state in your application</title>
      <link>https://juhanakristianblog.netlify.app/posts/why-you-should-use-url-to-store-state-in-your-application/</link>
      <pubDate>Sun, 28 Nov 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/why-you-should-use-url-to-store-state-in-your-application/</guid>
      <description>&lt;p&gt;It seems we have, in the web community, collectively forgotten the role of the URL in storing the state of our application. For good or bad, we&amp;rsquo;ve started developing websites like they are apps and forgotten one of the key elements of the web. I&amp;rsquo;ve seen (and built) applications where opening modals, searching, filtering, or navigating a wizard doesn&amp;rsquo;t change the URL. And this is wrong because it doesn&amp;rsquo;t fit the web paradigm.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What are HTTP cookies</title>
      <link>https://juhanakristianblog.netlify.app/posts/what-are-http-cookies/</link>
      <pubDate>Thu, 28 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/what-are-http-cookies/</guid>
      <description>&lt;p&gt;A HTTP cookie is a small piece of data that a server sends to a user&amp;rsquo;s web browser. The browser may then store the cookie and send it back to the same server with later requests.&lt;/p&gt;&#xA;&lt;p&gt;Cookies are used typically to tell if two HTTP requests come from the same browser/user. So for &lt;strong&gt;session management&lt;/strong&gt;, &lt;strong&gt;tracking&lt;/strong&gt; and to a lesser extent &lt;strong&gt;personalization&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For general data storage on the client, there are more modern APIs.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to make TypeScript understand Array.filter</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-make-typescript-understand-array-filter/</link>
      <pubDate>Mon, 04 Oct 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-make-typescript-understand-array-filter/</guid>
      <description>&lt;p&gt;If you&amp;rsquo;ve ever used Array.filter to filter a list to certain type of items, you&amp;rsquo;ve probably been hit by TypeScript not realizing what type of items your list contains after filtering. To fix this, you can use user-defined type guards.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say we have content items of two type: Post and Image.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;interface&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Post&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#a6e22e&#34;&gt;text&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;date&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;Date&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;interface&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Image&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;alt&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;date&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;Date&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We are going to store items of both types in a array.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why Docker is eating your disk space</title>
      <link>https://juhanakristianblog.netlify.app/posts/why-docker-is-eating-all-your-diskspace/</link>
      <pubDate>Thu, 23 Sep 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/why-docker-is-eating-all-your-diskspace/</guid>
      <description>&lt;p&gt;I learned recently, in less than ideal circumstances, that Docker doesn&amp;rsquo;t do &lt;strong&gt;any&lt;/strong&gt; log rotation by default 😱&lt;/p&gt;&#xA;&lt;p&gt;So if you&amp;rsquo;re running your application in production with Docker and using Docker&amp;rsquo;s default &lt;a href=&#34;https://docs.docker.com/config/containers/logging/configure/&#34;&gt;logging driver&lt;/a&gt; you might be awakened some night at 3 AM to fix a service outage when you can barely think straight. 😅&lt;/p&gt;&#xA;&lt;p&gt;The default logging driver is &lt;code&gt;json-file&lt;/code&gt; which caches the container logs as JSON. In practice, this means Docker is writing all the container &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt; to a JSON file located in the host systems &lt;code&gt;/var/lib/docker/containers&lt;/code&gt; folder.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to type an object with exclusive-or properties in TypeScript</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-type-an-object-with-exclusive-or-properties-in-typescript/</link>
      <pubDate>Sun, 12 Sep 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-type-an-object-with-exclusive-or-properties-in-typescript/</guid>
      <description>&lt;p&gt;How can we define a type for an object, which has some required attributes and some attributes, of which one and only one must be defined?&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say we want to define a type for a message that has a &lt;code&gt;timestamp&lt;/code&gt; and either a &lt;code&gt;text&lt;/code&gt; or an &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// ✅ This should be valid&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;messageWithText&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;timestamp&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2021-08-22T19:58:53+00:00&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;text&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello!&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// ✅ This should be valid&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;messageWithId&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;timestamp&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2021-08-22T19:58:53+00:00&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;123&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// ❌ This should be a type error &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;messageWithBoth&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;timestamp&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2021-08-22T19:58:53+00:00&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;123&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;text&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello!&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// ❌ This should be a type error &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;messageWithoutEither&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;timestamp&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2021-08-22T19:58:53+00:00&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;union-type&#34;&gt;Union type&lt;/h2&gt;&#xA;&lt;p&gt;One way to approach this would be to use a &lt;a href=&#34;https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types&#34;&gt;union type&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Advanced Django queries</title>
      <link>https://juhanakristianblog.netlify.app/posts/advanced-django-queries/</link>
      <pubDate>Tue, 27 Jul 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/advanced-django-queries/</guid>
      <description>&lt;p&gt;Django Framework comes with a powerful ORM and query capabilities built-in. If you&amp;rsquo;re only familiar with the basics of Djangos &lt;a href=&#34;https://docs.djangoproject.com/en/3.2/ref/models/querysets/#queryset-api&#34;&gt;Query API&lt;/a&gt;, this article will introduce some more advanced queries and methods you can use.&lt;/p&gt;&#xA;&lt;p&gt;In the examples, I&amp;rsquo;ll be using the following data models.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Author&lt;/span&gt;(models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Model):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    nickname &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CharField(max_length&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;20&lt;/span&gt;, null&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, blank&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    firstname &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CharField(max_length&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;20&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    lastname &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CharField(max_length&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;40&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    birth_date &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;DateField()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Book&lt;/span&gt;(models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Model):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    author &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;ForeignKey(Author, related_name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;books&amp;#34;&lt;/span&gt;, on_delete&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CASCADE)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    title &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CharField(unique&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, max_length&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    category &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;CharField(max_length&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    published &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;DateField()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    price &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;DecimalField(decimal_places&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;, max_digits&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rating &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; models&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;IntegerField()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;filtering&#34;&gt;Filtering&lt;/h3&gt;&#xA;&lt;p&gt;Basic filtering in Django can be done using something called &lt;em&gt;field lookups&lt;/em&gt; with the &lt;code&gt;filter&lt;/code&gt; method. Field lookups consist of the field and a suffix defining the lookup type. If no suffix is defined, the default behavior is equivalent to using the &lt;a href=&#34;https://docs.djangoproject.com/en/3.2/ref/models/querysets/#exact&#34;&gt;exact&lt;/a&gt; suffix.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use a cache busting filename with webpack</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-use-a-cache-busting-filename-with-webpack/</link>
      <pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-use-a-cache-busting-filename-with-webpack/</guid>
      <description>&lt;p&gt;If you&amp;rsquo;re using a custom webpack config, instead of a template or &lt;a href=&#34;https://create-react-app.dev/&#34;&gt;Create React App&lt;/a&gt;, you&amp;rsquo;ll want to make sure the filename has a cache busting suffix. Cache busting means making sure the users browser loads the newest version of our app, if it has been updated, instead of using a cached version.&lt;/p&gt;&#xA;&lt;p&gt;A naive webpack setup would just use a single output file with a fixed name.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;path&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;HtmlWebpackPlugin&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;html-webpack-plugin&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;module&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;exports&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;entry&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;./src/index.js&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;plugins&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;HtmlWebpackPlugin&lt;/span&gt;(),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;output&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;filename&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;bundle.js&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;resolve&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;__dirname&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dist&amp;#39;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here, we are using &lt;a href=&#34;https://webpack.js.org/plugins/html-webpack-plugin/&#34;&gt;HtmlWebpackPlugin&lt;/a&gt; to manage the creation of our &lt;strong&gt;index.html&lt;/strong&gt; file and it will handle inserting a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag into the &lt;strong&gt;index.html&lt;/strong&gt; with our bundle filename. For now we are bundling all of our JavaScript into single file called &lt;strong&gt;bundle.js&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Convert an array to a map in JavaScript</title>
      <link>https://juhanakristianblog.netlify.app/posts/convert-an-array-to-a-map-in-javascript/</link>
      <pubDate>Tue, 06 Jul 2021 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/convert-an-array-to-a-map-in-javascript/</guid>
      <description>&lt;p&gt;Sometimes it&amp;rsquo;s useful to convert a array to a map for convenience or performance reasons. But how can we achieve that so that the resulting code will be easy to understand?&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m using the term &lt;strong&gt;map&lt;/strong&gt; here to mean a data structure where a value can be accessed using an unique key. In JavaScript, objects can be used as maps but there also exists a special &lt;strong&gt;Map&lt;/strong&gt; &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map&#34;&gt;type&lt;/a&gt; which has some advantages and disandvantages when compared to using objects. We won&amp;rsquo;t be covering &lt;strong&gt;Map&lt;/strong&gt; in this article.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hidden gems of the Chrome DevTools, Part 2: CSS tools</title>
      <link>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-devtools-part-2/</link>
      <pubDate>Fri, 25 Jun 2021 23:59:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-devtools-part-2/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://juhanajauhiainen.com/posts/hidden-gems-of-the-chrome-dev-tools-part-1&#34;&gt;last article on the series&lt;/a&gt; we looked into some features on the Chrome Console API. This time we&amp;rsquo;ll see some of the tools Chrome has to offer when working with CSS and layouts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;inspect-layout&#34;&gt;Inspect layout&lt;/h2&gt;&#xA;&lt;p&gt;Chrome developer tools include handy tools for inspecting and debugging grid and flexbox layouts. When we open Chrome developer tools on the &lt;code&gt;Elements&lt;/code&gt; tab, you&amp;rsquo;ll find a &lt;code&gt;Layout&lt;/code&gt; tab right next to &lt;code&gt;Styles&lt;/code&gt; and &lt;code&gt;Computed&lt;/code&gt;. Under &lt;code&gt;Layout&lt;/code&gt; we will see a listing of all the grids and all the flexbox layouts on the current page.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hidden gems of the Chrome DevTools, Part 2: CSS tools</title>
      <link>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-dev-tools-part-3/</link>
      <pubDate>Mon, 21 Jun 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-dev-tools-part-3/</guid>
      <description>&lt;h2 id=&#34;accessibility-features&#34;&gt;Accessibility features&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;accesibility tab&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;debugger&#34;&gt;debugger&lt;/h2&gt;&#xA;&lt;h2 id=&#34;experimental&#34;&gt;Experimental&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;font editor in styles&lt;/li&gt;&#xA;&lt;li&gt;CSS overview&lt;/li&gt;&#xA;&lt;li&gt;flex box debugging&lt;/li&gt;&#xA;&lt;li&gt;accessibility tree&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Creating layouts with CSS grids</title>
      <link>https://juhanakristianblog.netlify.app/posts/creating-layouts-with-css-grids/</link>
      <pubDate>Wed, 16 Jun 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/creating-layouts-with-css-grids/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Grids are a powerfull feature of CSS but they can be a little overwhelming at first. There are rows, columns, areas, lines, and multiple syntaxes for defining layouts. How do these concepts fit together and how to use them effectively?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this article, we&amp;rsquo;ll go through some basic concepts of CSS grids and learn how we can use grids to build layouts. My goal is to shed some light on how to define grid areas grid lines, which I found somewhat confusing when learning CSS grids.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CSS grid by examples</title>
      <link>https://juhanakristianblog.netlify.app/posts/three-column-layout-with-css-grid/</link>
      <pubDate>Sat, 15 May 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/three-column-layout-with-css-grid/</guid>
      <description>&lt;h2 id=&#34;three-column-grid-layout&#34;&gt;Three column grid layout&lt;/h2&gt;&#xA;&lt;p&gt;The next example is a three column layout that could be used for example in a blog or a news site. It has a navbar and a grid that uses a automatic layout for it&amp;rsquo;s child elements.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://juhanakristianblog.netlify.app/images/grid-three-column-layout.png&#34; alt=&#34;Three column layout&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s the HTML structure we will be using&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;html&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;lang&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;en&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;head&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;meta&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;charset&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UTF-8&amp;#34;&lt;/span&gt; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;meta&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;viewport&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;width=device-width, initial-scale=1.0&amp;#34;&lt;/span&gt; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;meta&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;http-equiv&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;X-UA-Compatible&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ie=edge&amp;#34;&lt;/span&gt; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;&amp;gt;Three column layout&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;head&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;body&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;nav&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;Nav&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;nav&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;main&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hero&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Article&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Article&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Article&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Article&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Article&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;article&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;main&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;body&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;html&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this layout we will not be using grid for the whole page. Instead we will use conventional layout method like &lt;code&gt;position&lt;/code&gt; and &lt;code&gt;margin&lt;/code&gt; for the navbar and positioning the grid container. We will then use a grid for the layout of the content.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Create a retro text effect with CSS</title>
      <link>https://juhanakristianblog.netlify.app/posts/create-a-retro-text-effect-with-css/</link>
      <pubDate>Tue, 13 Apr 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/create-a-retro-text-effect-with-css/</guid>
      <description>&lt;p&gt;In this article, we&amp;rsquo;re going to create an 80&amp;rsquo;s style text effect with CSS. The effect uses multiple &lt;code&gt;text-shadow&lt;/code&gt;, &lt;code&gt;background-clip&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;, linear gradients and &lt;code&gt;-webkit-text-stroke&lt;/code&gt; to achieve a cool metallic effect.&lt;/p&gt;&#xA;&lt;p&gt;Before we dive into the actual CSS you probably want to see the end result.&lt;/p&gt;&#xA;&lt;iframe src=&#34;https://codesandbox.io/embed/retro-3d-text-demo-v3q3h?fontsize=14&amp;hidenavigation=1&amp;theme=dark&amp;view=preview&#34;&#xA;     style={{width:&#34;100%&#34;, height:500, border:0, borderRadius: 4, overflow:&#34;hidden&#34;}}&#xA;     title=&#34;retro-3d-text-demo&#34;&#xA;     allow=&#34;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#34;&#xA;     sandbox=&#34;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#34;&#xA;   &gt;&lt;/iframe&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start by defining our HTML markup that we will be using.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hidden gems of the Chrome DevTools, Part 1: The Console API</title>
      <link>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-dev-tools-part-1/</link>
      <pubDate>Sat, 03 Apr 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/hidden-gems-of-the-chrome-dev-tools-part-1/</guid>
      <description>&lt;p&gt;Debugging, or finding the reason why your code doesn&amp;rsquo;t work, is one of the most important skills a software developer needs. If you can debug effectively, you&amp;rsquo;ll catch problems faster and even gain a better understanding of how things work under the hood.&lt;/p&gt;&#xA;&lt;p&gt;In frontend development, we have a variety of tools available to debug our code. We can use a &lt;a href=&#34;https://code.visualstudio.com/Docs/editor/debugging&#34;&gt;debugger&lt;/a&gt; to step through our code, we can log values to the browser console and we can use the &lt;a href=&#34;https://developer.chrome.com/docs/devtools/&#34;&gt;DevTools&lt;/a&gt; of our browser.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Setup Spectron and Testing Library to effectively test your Electron.js application</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-test-electron-apps-with-spectron-and-testing-library/</link>
      <pubDate>Sun, 14 Mar 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-test-electron-apps-with-spectron-and-testing-library/</guid>
      <description>&lt;p&gt;In this article, we will setup &lt;a href=&#34;https://www.electronjs.org/spectron&#34;&gt;Spectron&lt;/a&gt; and use &lt;a href=&#34;https://testing-library.com/&#34;&gt;Testing Library&lt;/a&gt; with &lt;a href=&#34;https://webdriver.io&#34;&gt;WebdriverIO&lt;/a&gt; to test an &lt;a href=&#34;https://electronjs.org&#34;&gt;Electron.js&lt;/a&gt; application.&lt;/p&gt;&#xA;&lt;p&gt;Spectron is an open source framework for writing integration tests for Electron apps. It starts your application from the binary, so you can test it as a user would use it. Spectron is based on &lt;a href=&#34;https://sites.google.com/a/chromium.org/chromedriver&#34;&gt;ChromeDriver&lt;/a&gt; and &lt;a href=&#34;http://webdriver.io/&#34;&gt;WebdriverIO&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Testing Library WebdriverIO is a library you can use to test web applications through &lt;a href=&#34;https://webdriver.io&#34;&gt;WebdriverIO&lt;/a&gt;. It&amp;rsquo;s part of the &lt;a href=&#34;https://testing-library.com&#34;&gt;Testing Library&lt;/a&gt; family of libraries.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How using Testing Library will help you improve the accessibility of your application</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-testing-library-will-improve-accessibility/</link>
      <pubDate>Tue, 23 Feb 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-testing-library-will-improve-accessibility/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://testing-library.com&#34;&gt;Testing Library&lt;/a&gt; is a JavaScript testing framework that focuses on testing the way the application is used. Testing Library will also help you avoid testing implementation details and make your tests more maintainable. Testing the way the application is used will give us the confidence that the application is working as intended.&lt;/p&gt;&#xA;&lt;p&gt;What&amp;rsquo;s also nice about testing-library, is that its recommended queries are designed to work well on accessible elements. This means using Testing Library will also reveal accessibility problems in your application.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Mocking GraphQL APIs with Mock Service Worker</title>
      <link>https://juhanakristianblog.netlify.app/posts/mocking-graphql-apis-with-msw/</link>
      <pubDate>Sun, 14 Feb 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/mocking-graphql-apis-with-msw/</guid>
      <description>&lt;p&gt;Mock Service Worker (MSW) is a library for mocking, or faking, a backend API. This is extremely useful when you are developing new features into your application, or when you are running tests.&lt;/p&gt;&#xA;&lt;p&gt;In this article, I will guide you through setting up MSW for mocking a GraphQL API and show a few different kinds of ways you can mock queries and mutations. GitHub GraphQL API is used in the examples.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Creating a VS Code theme</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-create-your-own-vscode-theme/</link>
      <pubDate>Mon, 25 Jan 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-create-your-own-vscode-theme/</guid>
      <description>&lt;p&gt;Ever wanted to create a theme for VS Code? It&amp;rsquo;s simpler than you&amp;rsquo;d think but the process is a bit laborious and requires you to painstakingly go through all the attributes you need to change.&lt;/p&gt;&#xA;&lt;p&gt;If you want your theme to work, and look nice, on multiple programming languages, you&amp;rsquo;ll need to add a lot of color definitions.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve just released my first theme called &lt;a href=&#34;https://marketplace.visualstudio.com/items?itemName=juhanajauhiainen.lupine&#34;&gt;Lupine&lt;/a&gt; and this post goes how I created it and what I learned on the way.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Use box-sizing: border-box for simpler element sizing</title>
      <link>https://juhanakristianblog.netlify.app/posts/css-box-model/</link>
      <pubDate>Mon, 04 Jan 2021 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/css-box-model/</guid>
      <description>&lt;p&gt;The CSS property &lt;code&gt;box-sizing&lt;/code&gt; defines how the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; properties behave on a element with border or padding. Normally, when &lt;code&gt;box-sizing&lt;/code&gt; has its defualt value of &lt;code&gt;content-box&lt;/code&gt;, width and height affect the size of the &lt;strong&gt;content&lt;/strong&gt;. This means that if you have a element with &lt;code&gt;padding: 10px&lt;/code&gt;, &lt;code&gt;border: 8px&lt;/code&gt; and &lt;code&gt;width: 100px&lt;/code&gt; then full width of the element will be &lt;code&gt;136px&lt;/code&gt;. This also affects elements which have a relative &lt;code&gt;width&lt;/code&gt; or &lt;code&gt;height&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>My year in review 2020</title>
      <link>https://juhanakristianblog.netlify.app/posts/year-in-review-2020/</link>
      <pubDate>Thu, 31 Dec 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/year-in-review-2020/</guid>
      <description>&lt;p&gt;This has been a horrible year for most of us. COVID-19 has killed millions of people and changed life for millions more. The pandemic has also changed the way we work and live our daily lives.&lt;/p&gt;&#xA;&lt;p&gt;In this article I&amp;rsquo;m going to focus on the more positive things which have happened to me in 2020. &lt;/p&gt;&#xA;&lt;h2 id=&#34;work-habits&#34;&gt;Work habits&lt;/h2&gt;&#xA;&lt;p&gt;At the start of the year, I read Cal Newports Deep Work which had a positive effect on my daily work routine. I started using time blocking to get more focused work. I also try to schedule all meetings on the afternoon because I&amp;rsquo;m the most productive in the morning.&lt;/p&gt;</description>
    </item>
    <item>
      <title>A Tailwind CSS plugin for adding gradient masks</title>
      <link>https://juhanakristianblog.netlify.app/posts/tailwind-plugin-for-gradient-mask/</link>
      <pubDate>Mon, 09 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/tailwind-plugin-for-gradient-mask/</guid>
      <description>&lt;p&gt;Some time ago I added excerpts to my blog. A small sample of the full blog text is now shown on the front page after the post heading, date, and tags. To make the excerpts look a bit nicer, I wanted to add an effect that makes the text fade into the background.&lt;/p&gt;&#xA;&lt;p&gt;You can do this with the CSS mask-image property by setting its value to a linear-gradient.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-css&#34; data-lang=&#34;css&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;some-class&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;mask-image&lt;/span&gt;: linear-gradient(&lt;span style=&#34;color:#66d9ef&#34;&gt;to&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;top&lt;/span&gt;, rgba(&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1.0&lt;/span&gt;) &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;%&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;transparent&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;%&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I use Tailwind CSS to style my blog so I wanted to find a solution which doesn&amp;rsquo;t require adding CSS classes or files to my project.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Use useReducer to manage complex state</title>
      <link>https://juhanakristianblog.netlify.app/posts/use-userreducer-to-manage-complex-state/</link>
      <pubDate>Sat, 31 Oct 2020 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/use-userreducer-to-manage-complex-state/</guid>
      <description>&lt;p&gt;&lt;code&gt;useReducer&lt;/code&gt; is a React Hook which helps you manage complex state with a simple API. The hook takes a reducer function and the initial state as parameters. You can also pass in an optional argument which can be a function for lazy initialization of the state.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s the simplest example of using useReducer you can think of.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;React&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;react&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;reducer&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;newValue&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;newValue&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;App&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; [&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;setValue&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;React&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;useReducer&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;reducer&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;className&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;App&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;h1&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;{&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;}&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;/h1&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;button&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onClick&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;{() =&amp;gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;setValue&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)}&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Increment&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;/button&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;/div&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We are using &lt;code&gt;useReducer&lt;/code&gt; for managing a single value, like when we use &lt;code&gt;useState&lt;/code&gt;. But &lt;code&gt;useReducer&lt;/code&gt; can do much more than that!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Manage React state with the useContext hook</title>
      <link>https://juhanakristianblog.netlify.app/posts/manage-react-state-with-the-usecontext-hook/</link>
      <pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/manage-react-state-with-the-usecontext-hook/</guid>
      <description>&lt;p&gt;&lt;strong&gt;DISCLAIMER&lt;/strong&gt;: This post is based on state management ideas presented by Kent C. Dodd’s in &lt;a href=&#34;https://kentcdodds.com/blog/application-state-management-with-react&#34;&gt;Application state management with React&lt;/a&gt;. If you haven&amp;rsquo;t read it, I encourage you to do so.&lt;/p&gt;&#xA;&lt;p&gt;React projects have many options for managing state. While libraries like &lt;code&gt;redux&lt;/code&gt; and &lt;code&gt;mobx&lt;/code&gt; are a popular choice, React also has it&amp;rsquo;s own API for managing state. The Context API is useful when you have state which is accessed in multiple places in your app and you want to avoid &lt;a href=&#34;https://kentcdodds.com/blog/prop-drilling&#34;&gt;prop drilling&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Make custom marker displaying users location and direction with react-native-maps on iOS</title>
      <link>https://juhanakristianblog.netlify.app/posts/make-custom-marker-displaying-users-location-and-direction/</link>
      <pubDate>Wed, 30 Sep 2020 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/make-custom-marker-displaying-users-location-and-direction/</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTICE:&lt;/strong&gt; This post is about showing a custom location and direction indicator with react-native-maps on &lt;strong&gt;iOS&lt;/strong&gt;. This involves a &lt;em&gt;hack&lt;/em&gt; which probably isn&amp;rsquo;t needed on Android. On Android rotation works just by adding the &lt;code&gt;rotation&lt;/code&gt;prop to the Marker and setting it to the current heading. As far as I know this hack is only required for iOS.&lt;/p&gt;&#xA;&lt;p&gt;If you want to display the current GPS location with your own custom graphics in React Native Maps, you need to create a custom Marker. This is done fairly easily, since the Marker component accepts a View as child.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What is React Strict Mode?</title>
      <link>https://juhanakristianblog.netlify.app/posts/what-is-react-strict-mode/</link>
      <pubDate>Sat, 26 Sep 2020 00:00:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/what-is-react-strict-mode/</guid>
      <description>&lt;p&gt;React Strict Mode is a tool, which comes with React, for detecting possible issues and problems in your application. Currently (Sept. 2020) Strict Mode detects if you have &lt;a href=&#34;https://reactjs.org/docs/strict-mode.html#identifying-unsafe-lifecycles&#34;&gt;unsafe lifecycle methods&lt;/a&gt;, &lt;a href=&#34;https://reactjs.org/docs/strict-mode.html#warning-about-legacy-string-ref-api-usage&#34;&gt;usage of legacy string ref API&lt;/a&gt;, &lt;a href=&#34;https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage&#34;&gt;usage of findDOMNode&lt;/a&gt;, &lt;a href=&#34;https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects&#34;&gt;detecting unexpected side effects&lt;/a&gt; or &lt;a href=&#34;https://reactjs.org/docs/strict-mode.html#detecting-legacy-context-api&#34;&gt;detecting usage of legacy context API&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So basically, using Strict Mode will help you detect if your app or libraries are using React APIs which are deprecated, unsafe in async code or have problems which might cause bugs. &lt;strong&gt;Strict Mode warnings are only displayed in development&lt;/strong&gt;, so you don&amp;rsquo;t have to worry about them showing up in production. In the future, Strict Mode will likely add other warnings so even if you don&amp;rsquo;t have any now, it&amp;rsquo;s a good idea to keep using it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Access DOM element in a child component in React</title>
      <link>https://juhanakristianblog.netlify.app/posts/access-dom-element-in-a-child-component-in-react/</link>
      <pubDate>Tue, 18 Aug 2020 06:45:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/access-dom-element-in-a-child-component-in-react/</guid>
      <description>&lt;p&gt;Sometimes we need access a DOM element which is contained by another React component. If we try to just use &lt;a href=&#34;https://reactjs.org/docs/refs-and-the-dom.html&#34;&gt;ref&lt;/a&gt; and pass it to the child component, we get an error.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ChildComponent&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;props&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ref&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#a6e22e&#34;&gt;props&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;ref&lt;/span&gt;}&amp;gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Hello&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;there&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;App&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;childRef&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;React&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;useRef&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;className&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;App&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;ChildComponent&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ref&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#a6e22e&#34;&gt;childRef&lt;/span&gt;} /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img src=&#34;https://juhanakristianblog.netlify.app/images/referror.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is because ref is a reserved prop name so you can&amp;rsquo;t pass it to a child component. Instead we can use forwardRef when defining the child component.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Customize Django admin with list_display property</title>
      <link>https://juhanakristianblog.netlify.app/posts/customize-django-admin-with-list-display-property/</link>
      <pubDate>Thu, 23 Jul 2020 23:32:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/customize-django-admin-with-list-display-property/</guid>
      <description>&lt;p&gt;One of the great &amp;ldquo;batteries included&amp;rdquo; features Django has, is the automatically generated admin panel. It provides a simple UI for creating, editing and deleting data defined with the Django ORM. In this article we are going to enable the admin user interface for a simple model and customize it from a simple list view to a more user friendly table like interface.&lt;/p&gt;&#xA;&lt;p&gt;Lets say we have a simple model &lt;code&gt;Item&lt;/code&gt; which has two fields &lt;code&gt;name&lt;/code&gt;and &lt;code&gt;price&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using namedtuple to create simple data objects in Python</title>
      <link>https://juhanakristianblog.netlify.app/posts/using-namedtuple-to-create-simple-data-objects-in-python/</link>
      <pubDate>Mon, 29 Jun 2020 23:30:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/using-namedtuple-to-create-simple-data-objects-in-python/</guid>
      <description>&lt;p&gt;Python standard library has a handy collection factory function called &lt;a href=&#34;https://docs.python.org/3/library/collections.html#collections.namedtuple&#34;&gt;namedtuple&lt;/a&gt;, which can be used to assign names for each position in a tuple.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Named tuples behave otherwise like a normal tuples but each element has a name which can be used for retrieving the value just like with class objects.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; collections &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; namedtuple&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Item &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; namedtuple(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Item&amp;#34;&lt;/span&gt;, [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;price&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;quantity&amp;#34;&lt;/span&gt;])&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here we first import &lt;code&gt;namedtuple&lt;/code&gt;from the &lt;code&gt;collections&lt;/code&gt;module in the standard library and then create a named tuple called &lt;code&gt;Item&lt;/code&gt;with the properties &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;price&lt;/code&gt; and &lt;code&gt;quantity&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Introduction to relative CSS units</title>
      <link>https://juhanakristianblog.netlify.app/posts/introduction-to-relative-css-units/</link>
      <pubDate>Mon, 22 Jun 2020 23:38:00 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/introduction-to-relative-css-units/</guid>
      <description>&lt;p&gt;With CSS you can use absolute units like the familiar &lt;code&gt;px&lt;/code&gt;, &lt;code&gt;pt&lt;/code&gt; or relative units like &lt;code&gt;em&lt;/code&gt; and &lt;code&gt;rem&lt;/code&gt; . Absolute units are quite simple to use and rarely cause confusion. Relative units however can twist your brain if your not familiar with how they work.&lt;/p&gt;&#xA;&lt;p&gt;We are going to go through some of the most common relative units with simple examples that hopefully help you understand how they work and how to use them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Create a React Hook to show browser online status</title>
      <link>https://juhanakristianblog.netlify.app/posts/create-a-react-hook-to-show-browsers-online-status/</link>
      <pubDate>Sun, 31 May 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/create-a-react-hook-to-show-browsers-online-status/</guid>
      <description>&lt;p&gt;React Hooks are a way of adding logic to your functional components in an simple and elegant way. In addition to the &lt;a href=&#34;https://reactjs.org/docs/hooks-reference.html&#34;&gt;standard hooks&lt;/a&gt; like &lt;code&gt;useState&lt;/code&gt; or &lt;code&gt;useEffect&lt;/code&gt; you can also create your own hooks if find you need the same logic in multiple components.&lt;/p&gt;&#xA;&lt;p&gt;A &lt;a href=&#34;https://reactjs.org/docs/hooks-custom.html&#34;&gt;custom hook&lt;/a&gt; is nothing more than a JavaScript function which starts with &amp;ldquo;use&amp;rdquo; and that may call other hooks. In this article I will show you how to create a simple hook for showing the network status of the users browser.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Small projects for learning the Rust programming language</title>
      <link>https://juhanakristianblog.netlify.app/posts/small-projects-for-learning-the-rust-programming-language/</link>
      <pubDate>Tue, 19 May 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/small-projects-for-learning-the-rust-programming-language/</guid>
      <description>&lt;p&gt;Inspired by some of &lt;a href=&#34;https://www.youtube.com/channel/UC_iD0xppBwwsrM9DegC5cQQ&#34;&gt;Jon Gjensets&lt;/a&gt; Rust streams and videos I decided to start learning Rust (again!). I&amp;rsquo;ve previously read part of the &lt;a href=&#34;https://doc.rust-lang.org/&#34;&gt;Rust book&lt;/a&gt; but never started any projects with it so I didn&amp;rsquo;t retain much of it.&lt;/p&gt;&#xA;&lt;p&gt;This time I decided I&amp;rsquo;ll go through the book but I&amp;rsquo;ll also create a repository with increasingly difficult practice problems to solve.&lt;/p&gt;&#xA;&lt;p&gt;So far I&amp;rsquo;ve come up with the following list of problems&lt;/p&gt;</description>
    </item>
    <item>
      <title>Making API calls in React useEffect</title>
      <link>https://juhanakristianblog.netlify.app/posts/making-api-calls-with-react-useeffect/</link>
      <pubDate>Sat, 16 May 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/making-api-calls-with-react-useeffect/</guid>
      <description>&lt;p&gt;&lt;code&gt;useEffect&lt;/code&gt; is a &lt;a href=&#34;https://reactjs.org/docs/hooks-effect.html&#34;&gt;hook&lt;/a&gt; added in React 16.8. It allows you to perform &lt;a href=&#34;https://en.wikipedia.org/wiki/Side_effect_(computer_science)&#34;&gt;side effects&lt;/a&gt; in function components. This means you can update things outside of React based on your &lt;code&gt;props&lt;/code&gt;and &lt;code&gt;state&lt;/code&gt;. Fetching data when the component state changes, changing the page &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; or connecting to a WebSocket server are all examples of side effects that can be done with &lt;code&gt;useEffect&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As an example, we are going to build a component which fetches data from &lt;a href=&#34;https://alexwohlbruck.github.io/cat-facts/&#34;&gt;Cat Facts API&lt;/a&gt; and displays the received facts as a list. Finally we&amp;rsquo;ll add buttons to select the animal we want facts about.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Dark mode using prefers-color-scheme rule and CSS variables</title>
      <link>https://juhanakristianblog.netlify.app/posts/dark-mode-using-prefers-color-scheme/</link>
      <pubDate>Thu, 14 May 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/dark-mode-using-prefers-color-scheme/</guid>
      <description>&lt;p&gt;In this article I&amp;rsquo;ll show you how to implement dark mode in your blog or site using &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/CSS/--*&#34;&gt;CSS variables&lt;/a&gt; and how the toggle it automatically based on the users &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme&#34;&gt;preferred color scheme&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;CSS variables are a new way to make CSS more maintainable by defining reusable variables which are defined in one place and can be referenced in multiple other places.&lt;/p&gt;&#xA;&lt;p&gt;For our dark mode example we&amp;rsquo;ll be changing the sites background and text colors when the user has set dark mode as preference at &lt;a href=&#34;https://support.apple.com/en-us/HT208976&#34;&gt;system level&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to loop over a JavaScript object</title>
      <link>https://juhanakristianblog.netlify.app/posts/how-to-loop-over-a-javascript-object/</link>
      <pubDate>Thu, 30 Apr 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/how-to-loop-over-a-javascript-object/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s a few ways to loop over a object in JavaScript. Let&amp;rsquo;s look at a couple of them.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say we have a object like this&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;animals&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;cat&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;meow&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;dog&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;woof&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;duck&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;quack&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;pig&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;oink&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;turkey&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gobble&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One way to loop over a object is to use the &lt;code&gt;Object.keys()&lt;/code&gt; function to first retrieve the keys in a object and then loop over the returned array.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;keys&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Object.&lt;span style=&#34;color:#a6e22e&#34;&gt;keys&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;animals&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;keys&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;animal&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;keys&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sound&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;animals&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;animal&lt;/span&gt;];&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;`A &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;animal&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; says &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sound&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;!`&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// A cat says meow!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// A dog says woof!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// A duck says quack!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// A pig says oink!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// A turkey says gobble!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You could also use Array function &lt;code&gt;forEach&lt;/code&gt; for looping the array but in ES6 the &lt;code&gt;for..of&lt;/code&gt; syntax was introduced for looping iterators (including arrays).&lt;/p&gt;</description>
    </item>
    <item>
      <title>The very basics of React Hooks</title>
      <link>https://juhanakristianblog.netlify.app/posts/react-hooks-basics/</link>
      <pubDate>Mon, 27 Apr 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/react-hooks-basics/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://reactjs.org/docs/hooks-intro.html&#34;&gt;Hooks&lt;/a&gt; are an React API that were introduced in &lt;a href=&#34;https://reactjs.org/blog/2019/02/06/react-v16.8.0.html&#34;&gt;React 16.8&lt;/a&gt; a little more than a year ago (february 2019).&#xA;They let you use &lt;a href=&#34;https://reactjs.org/docs/state-and-lifecycle.html&#34;&gt;state&lt;/a&gt; in your React &lt;a href=&#34;https://reactjs.org/docs/components-and-props.html&#34;&gt;components&lt;/a&gt; without writing classes.&lt;/p&gt;&#xA;&lt;p&gt;In this post I&amp;rsquo;ll talk about the &lt;code&gt;useState&lt;/code&gt; hook and after reading it you&amp;rsquo;ll have a basic idea how to use it to add state to your functional components.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start with a simple functional component.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;React&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;react&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Cat&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;🐱&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here we are simply rendering a cat emoji inside a humble span element.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Memoization in Python</title>
      <link>https://juhanakristianblog.netlify.app/posts/memoization-in-python/</link>
      <pubDate>Fri, 17 Apr 2020 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/memoization-in-python/</guid>
      <description>&lt;p&gt;Memoization is a optimization technique frequently used in functional&#xA;programming. It means storing the result of a computationally intensive function&#xA;call and returing the cached result when the function is called with the same arguments.&lt;/p&gt;&#xA;&lt;p&gt;Python 3.2 introduced the &lt;code&gt;functools.lru_cache&lt;/code&gt; decorator which enables&#xA;memoization of function results in Python.&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;code&gt;lru_cache&lt;/code&gt; is simple as we can see from a example taken from the &lt;a href=&#34;https://docs.python.org/3.8/library/functools.html&#34;&gt;Python documentation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@lru_cache&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;count_vowels&lt;/span&gt;(sentence):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sentence &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sentence&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;casefold()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; sum(sentence&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;count(vowel) &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; vowel &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;aeiou&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When calling for ex. &lt;code&gt;count_vowels(&#39;Count vowels in this sentence&#39;)&lt;/code&gt; the result&#xA;is cached and when you call the function with the same argument the cached&#xA;result is returned instead of counting the vowels again. This can be a huge performance boost when dealing with big datasets with potentially similar data.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python class and instance variables</title>
      <link>https://juhanakristianblog.netlify.app/posts/python-class-variables/</link>
      <pubDate>Wed, 11 Mar 2020 18:18:03 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/python-class-variables/</guid>
      <description>&lt;p&gt;Confusing class variables and instance variables in Python is a pretty common mistake. Or.. atleast I&amp;rsquo;ve made it more than once.&#xA;Python doesn&amp;rsquo;t use &lt;code&gt;static&lt;/code&gt; keyword but instead the location the variables are defined in to differentiate between the two which will seem pretty foreign to people coming from other object oriented languages.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s an example of how you would declare class variables in Python&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Foo&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bar &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;instance &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Foo()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;bar&lt;/code&gt; is now accessible by &lt;code&gt;Foo.bar&lt;/code&gt;, &lt;code&gt;self.bar&lt;/code&gt; inside the methods of class &lt;code&gt;Foo&lt;/code&gt;&#xA;and with &lt;code&gt;instance.bar&lt;/code&gt; using a instance of the class.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using functools.partial</title>
      <link>https://juhanakristianblog.netlify.app/posts/using-functools-partial/</link>
      <pubDate>Sun, 23 Feb 2020 20:28:34 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/using-functools-partial/</guid>
      <description>&lt;p&gt;I’ve gotten used to a functional programming style in JavaScript and I’m finding I want to use same kind of paradigms in Python.&lt;/p&gt;&#xA;&lt;p&gt;Builtin methods like &lt;strong&gt;map()&lt;/strong&gt; and &lt;strong&gt;filter()&lt;/strong&gt; already help but the &lt;strong&gt;functools&lt;/strong&gt; module provides additional ways to do functional programming.&lt;/p&gt;&#xA;&lt;p&gt;Let’s look at what the &lt;strong&gt;functools.partial&lt;/strong&gt; function can do.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;partial()&lt;/strong&gt; can be take a function of many parameters and make it a function of few paramters. This is very useful if you have to call the same function&lt;br&gt;&#xA;multiple times with almost the same parameters.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Generating forms from JSON schema in React applications</title>
      <link>https://juhanakristianblog.netlify.app/posts/generating-forms-from-json-schema-in-react-applications/</link>
      <pubDate>Sun, 19 Jan 2020 20:19:10 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/generating-forms-from-json-schema-in-react-applications/</guid>
      <description>&lt;p&gt;Automatically generating UI from a schema document can be a powerful prototyping tool or can even be used to build simple apps if the requirements aren&amp;rsquo;t too complex.&lt;/p&gt;&#xA;&lt;p&gt;One awesome library for generating UIs from &lt;a href=&#34;https://json-schema.org/&#34;&gt;json-schemas&lt;/a&gt; is &lt;a href=&#34;https://github.com/rjsf-team/react-jsonschema-form&#34;&gt;react-jsonschema-form&lt;/a&gt;. react-jsonschema-from can be used to automatically generate forms in a React application from a JSON schema document.&lt;/p&gt;&#xA;&lt;p&gt;I found the library easy to use and it was perfect for my use case of a form input app which could later be expanded with additional forms with minimal coding.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JSON diffing</title>
      <link>https://juhanakristianblog.netlify.app/posts/formatting-json-by-building-a-parse-tree/</link>
      <pubDate>Sun, 08 Sep 2019 09:33:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/formatting-json-by-building-a-parse-tree/</guid>
      <description>&lt;p&gt;Some time ago a client asked if I knew a tool for formatting and comparing JSON data. The use case he was after was comparing JSON data returned by an API to the expected output.&lt;/p&gt;&#xA;&lt;p&gt;I’d been on the look for a similar tool myself mainly for formatting and inspecting sizeable JSON data dumps. A number of online tools exist for formatting JSON but most of them either were serving ads or had a horribly cluttered interface.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Lexers and parsers</title>
      <link>https://juhanakristianblog.netlify.app/posts/lexers-and-parsers-4/</link>
      <pubDate>Wed, 14 Aug 2019 18:42:03 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/lexers-and-parsers-4/</guid>
      <description>&lt;p&gt;Read some blog posts by Drew Youngwerth on lexers and parsers at &lt;a href=&#34;https://drew.ltd/blog/posts/2020-7-18.html&#34;&gt;drew.ltd/blog/posts/2020-7-18.html&lt;/a&gt; They inspired me to use a lexer and a parser for formatting JSON in a electron app I’m working on.&lt;/p&gt;&#xA;&lt;p&gt;-brandfilt&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using django-registration for simple user registration</title>
      <link>https://juhanakristianblog.netlify.app/posts/using-django-registration-for-simple-user-registration/</link>
      <pubDate>Fri, 05 Jul 2019 21:10:01 +0000</pubDate>
      <guid>https://juhanakristianblog.netlify.app/posts/using-django-registration-for-simple-user-registration/</guid>
      <description>&lt;p&gt;Recently I had to setup a web app with simple one step user registration. After some searching I came accross a Django library called django-registration which seemed like the best way to implement user registration. It features single step and two step registration flows, some simple views and simple installation and configuration. In this blog post I’m going to go over the steps needed to implement user registration in a Django app.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
