<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michal Gasparik on Medium]]></title>
        <description><![CDATA[Stories by Michal Gasparik on Medium]]></description>
        <link>https://medium.com/@gaspm?source=rss-87a7674fbbc8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vGUGgb9qtjanl1S7r8d7Cw.png</url>
            <title>Stories by Michal Gasparik on Medium</title>
            <link>https://medium.com/@gaspm?source=rss-87a7674fbbc8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 12:08:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gaspm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Create Your Own Web Component and Implement It in React, Angular, or Vue]]></title>
            <link>https://blog.stackademic.com/create-your-own-web-component-and-implement-it-in-react-angular-or-vue-b24ead4bb3bd?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b24ead4bb3bd</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Fri, 20 Sep 2024 18:52:49 GMT</pubDate>
            <atom:updated>2024-09-30T03:07:42.923Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to build a custom web component from scratch with this guide. Explore how to seamlessly integrate your component into popular frameworks/libraries</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLjlB77nVnR3z-gyvcn8ig.png" /></figure><h4>Web Components in Nutshell</h4><p>WC<strong> </strong>are a set of standardized technologies that allow developers to create reusable, encapsulated, and modular elements for web applications. These components work across modern browsers and are designed to integrate seamlessly with existing frameworks and libraries.</p><h4>Browser Compatibility</h4><p>You can verify that Web Components are supported by a wide range of web browsers on <a href="https://caniuse.com/?search=web%20components"><strong>Can I Use</strong></a>.</p><h3>Example: Google Maps Web Component from Scratch</h3><p>Although Google Maps provides an <a href="https://developers.google.com/maps/documentation/javascript/add-google-map#web-components">official Web Component</a>, we will create our own for demonstration and understanding of web components.Map displayed on a running Angular 18 framework, React 18 Library and Vue 13 Library on localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nqa9nj_c_Ri7sLCeXR5gJg.png" /></figure><h4>wc-gmap.js</h4><p>This is how the code of a Web Component may look like. Below, we will take a detailed look at how this code works.</p><pre>export class WcGmap extends HTMLElement {<br>  constructor() {<br>    super();<br>    this.map = null;<br>  }<br><br>  connectedCallback() {<br>    const apiKey = this.getAttribute(&#39;apikey&#39;);<br>    if (!apiKey) {<br>      return console.error(&#39;Google Maps API key is required&#39;);<br>    }<br><br>    this.setupMapContainer();<br>    this.loadGoogleMapsAPI(apiKey)<br>        .then(() =&gt; this.initializeMap())<br>        .catch(error =&gt; console.error(&#39;Error Google Maps API:&#39;, error));<br>  }<br><br>  setupMapContainer() {<br>    const width = this.getAttribute(&#39;width&#39;) || &#39;100%&#39;;<br>    const height = this.getAttribute(&#39;height&#39;) || &#39;400px&#39;;<br>    Object.assign(this.style, {<br>      display: &#39;block&#39;,<br>      width,<br>      height<br>    });<br>  }<br><br>  initializeMap() {<br>    const lat = parseFloat(this.getAttribute(&#39;lat&#39;)) || 0;<br>    const lng = parseFloat(this.getAttribute(&#39;lng&#39;)) || 0;<br>    const zoom = parseInt(this.getAttribute(&#39;zoom&#39;)) || 8;<br>    const markers = JSON.parse(this.getAttribute(&#39;markers&#39;) || &#39;[]&#39;);<br><br>    this.map = new google.maps.Map(this, {<br>      center: { lat, lng },<br>      zoom<br>    });<br><br>    this.addMarkers(markers);<br>  }<br><br>  addMarkers(markers = []) {<br>    markers.forEach(marker =&gt; {<br>      new google.maps.Marker({<br>        position: { lat: marker.lat, lng: marker.lng },<br>        map: this.map,<br>        title: marker.title || &#39;&#39;<br>      });<br>    });<br>  }<br><br>  loadGoogleMapsAPI(apiKey) {<br>    return new Promise((resolve, reject) =&gt; {<br>      if (window.google?.maps) {<br>        return resolve();<br>      }<br><br>      const querySelector = &#39;script[src*=&quot;maps.googleapis.com&quot;]&#39;;<br>      const existingScript = document.querySelector(querySelector);<br>      if (existingScript) {<br>        existingScript.addEventListener(&#39;load&#39;, resolve);<br>        existingScript.addEventListener(&#39;error&#39;, reject);<br>        return;<br>      }<br><br>      const script = document.createElement(&#39;script&#39;);<br>      script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&amp;libraries=maps&amp;callback=initMap&amp;language=en&amp;region=US`;<br>      script.async = true;<br>      script.defer = true;<br>      script.onload = resolve;<br>      script.onerror = reject;<br>      document.head.appendChild(script);<br><br>      window.initMap = resolve;<br>    });<br>  }<br>}<br><br>customElements.define(&#39;wc-gmap&#39;, WcGmap);</pre><h4>Explanation JS:</h4><p><strong>constructor</strong>:</p><ul><li>Calls the parent HTMLElement constructor using super().</li><li>Initializes the map property, which will later hold the Google Map instance.</li></ul><p><strong>connectCallback</strong>:</p><ul><li>This lifecycle method is called when the element is inserted into the DOM.</li><li>It retrieves the width, height, and API key from the element’s attributes.</li><li>It loads the Google Maps API asynchronously using the API key.</li><li>After the API is loaded, it initializes the map.</li></ul><p><strong>initializeMap</strong>:</p><ul><li>Retrieves latitude, longitude, and zoom level from the element’s attributes.</li><li>Creates a Google Map instance, setting the map’s center and zoom level.</li><li>If any markers are provided through the markers attribute, it calls addMarkers to place them on the map.</li></ul><p><strong>addMarkers</strong>:</p><ul><li>Loops through the provided marker data (an array of marker objects) and creates a Google Maps Marker for each one.</li><li>Sets the marker’s position and title based on the attributes in the marker object.</li></ul><p><strong>loadGoogleMapsApi</strong>:</p><ul><li>Loops through the provided marker data (an array of marker objects) and creates a Google Maps Marker for each one.</li><li>Sets the marker’s position and title based on the attributes in the marker object.</li></ul><p>This code is a fully functional custom web component for Google Maps that dynamically loads the API, creates the map, and optionally places markers.</p><h4>Explanation HTML:</h4><p><strong>&lt;wc-gmap&gt;</strong>: This is a custom web component defined in the wc-gmap.js file. It renders a Google Map on the page based on the attributes provided.</p><p><strong>Attributes</strong>:</p><p><strong>width=&quot;800px&quot;</strong>: Sets the map&#39;s width to 800 pixels.</p><p><strong>height=&quot;300px&quot;</strong>: Sets the map&#39;s height to 300 pixels.</p><p><strong>lat=&quot;37.7749&quot;</strong> and <strong>lng=&quot;-122.4194&quot;</strong>: These attributes set the center of the map to San Francisco (latitude 37.7749, longitude -122.4194).</p><p><strong>zoom=&quot;12&quot;</strong>: Sets the initial zoom level of the map to 12.</p><p><strong>apiKey=&quot;YOUR_API_KEY&quot;</strong>: This is a placeholder for the Google Maps API key, which you must replace with your actual API key.</p><ul><li><strong>markers</strong>: This attribute contains a JSON array of marker data. Each marker object has:</li><li><strong>lat</strong>: Latitude for the marker&#39;s position.</li><li><strong>lng</strong>: Longitude for the marker&#39;s position.</li><li><strong>title</strong>: The title that will appear when hovering over the marker.</li></ul><h3><strong>Implemetation for Frontend Frameworks/</strong>Libraries</h3><h3>React</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6ozuBzjO0A5CbXnq1acQg.png" /></figure><h4>File Structure</h4><p>A simplified version of the React file structure for the purposes of demonstrating a Web Component.</p><pre>├── react<br>│   ├── wc-gmap-demo<br>│   │   ├── src<br>│   │   │   ├── web-components<br>│   │   │   │   └── wc-gmap.js<br>│   │   │   └── App.js<br>│   │   └── .eslintignore</pre><h4>App.js</h4><pre>import &#39;./App.css&#39;;<br>import &#39;./web-components/wc-gmap&#39;;<br><br>function App() {<br>  return (<br>    &lt;wc-gmap<br>        width=&quot;800px&quot;<br>        height=&quot;300px&quot;<br>        lat=&quot;37.7749&quot;<br>        lng=&quot;-122.4194&quot;<br>        zoom=&quot;12&quot;<br>        apikey=&quot;YOUR_API_KEY&quot;<br>        markers={<br>          JSON.stringify([<br>            {lat: 37.7749, lng: -122.4194, title: &quot;San Francisco&quot;},<br>            {lat: 37.7912, lng: -122.3920, title: &quot;Google - 345 Spear St&quot;},<br>            {lat: 37.7898, lng: -122.3942, title: &quot;Airbnb - 888 Brannan St&quot;},<br>            {lat: 37.7894, lng: -122.4018, title: &quot;Uber - 1455 Market St&quot;},<br>            {lat: 37.7896, lng: -122.3908, title: &quot;Pinterest - 651 Brannan St&quot;}<br>          ])<br>      }<br>    /&gt;<br>  );<br>}<br><br>export default App;</pre><h4>.eslintignore</h4><p>Different projects may have different ESLint rules. Therefore, I recommend adding a <strong>.eslintignore</strong> to the <strong>root</strong> of the project.</p><pre># Ignore specific file<br>src/web-components/wc-gmap.js</pre><h4>Result in Browser</h4><p>Map displayed on a running <strong>React 18 Library</strong> on <strong>localhost:3000</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*cK0OpgxcODFlshnnRy5p8A.png" /><figcaption>Web Component wc-gmap in React 18.3.1</figcaption></figure><h3>Angular</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZQki1sJoaGSI7nq2C79BA.png" /></figure><h4>File Structure</h4><p>A simplified version of the Angular file structure for the purposes of demonstrating a Web Component.</p><pre>├── angular<br>│   ├── wc-gmap-demo<br>│   │   ├── src<br>│   │   │   ├── app<br>│   │   │   │   ├── web-components<br>│   │   │   │   │   └── wc-gmap.js<br>│   │   │   │   ├── app.component.html<br>│   │   │   │   └── app.component.ts</pre><h4>app.component.ts</h4><p>Import <strong>wc-gmap.js</strong> and add <strong>CUSTOM_ELEMENTS_SCHEMA</strong> to <strong>schemas</strong></p><pre>import {Component, CUSTOM_ELEMENTS_SCHEMA} from &#39;@angular/core&#39;;<br>import {RouterOutlet} from &#39;@angular/router&#39;;<br>import &#39;./web-components/wc-gmap&#39;; // import Web Component<br><br>@Component({<br>  selector: &#39;app-root&#39;,<br>  standalone: true,<br>  imports: [RouterOutlet],<br>  templateUrl: &#39;./app.component.html&#39;,<br>  styleUrl: &#39;./app.component.scss&#39;,<br>  schemas: [CUSTOM_ELEMENTS_SCHEMA], // add CUSTOM_ELEMENTS_SCHEMA<br>})<br>export class AppComponent {<br>  title = &#39;wc-gmap-demo&#39;;<br>}</pre><h4>app.component.html</h4><p>Delete the default content after installing Angular and replace it with a Gmap Web Component.</p><pre>&lt;wc-gmap<br>  width=&quot;800px&quot;<br>  height=&quot;300px&quot;<br>  lat=&quot;37.7749&quot;<br>  lng=&quot;-122.4194&quot;<br>  zoom=&quot;12&quot;<br>  apiKey=&quot;YOUR_API_KEY&quot;<br>  markers=&#39;[<br>   {&quot;lat&quot;: 37.7749, &quot;lng&quot;: -122.4194, &quot;title&quot;: &quot;San Francisco&quot;},<br>   {&quot;lat&quot;: 37.7912, &quot;lng&quot;: -122.3920, &quot;title&quot;: &quot;Google - 345 Spear St&quot;},<br>   {&quot;lat&quot;: 37.7898, &quot;lng&quot;: -122.3942, &quot;title&quot;: &quot;Airbnb - 888 Brannan St&quot;},<br>   {&quot;lat&quot;: 37.7894, &quot;lng&quot;: -122.4018, &quot;title&quot;: &quot;Uber - 1455 Market St&quot;},<br>   {&quot;lat&quot;: 37.7896, &quot;lng&quot;: -122.3908, &quot;title&quot;: &quot;Pinterest - 651 Brannan St&quot;}<br>  ]&#39;&gt;<br>&lt;/wc-gmap&gt;</pre><h4>Result in Browser</h4><p>Map displayed on a running <strong>Angular 18 framework</strong> on <strong>localhost:4200</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*aitF_DHHYiZqd_J71uqQ1w.png" /><figcaption>Web Component wc-gmap in Angular 18.2.0</figcaption></figure><h3>Vue</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSvDsEIOzZgfH1hAR4Lwcw.png" /></figure><h4>File Structure</h4><p>A simplified version of the Vue file structure for the purposes of demonstrating a Web Component.</p><pre>├── vue<br>│   ├── wc-gmap-demo<br>│   │   ├── src<br>│   │   │   ├── web-components<br>│   │   │   │   └── wc-gmap.js<br>│   │   │   └── App.vue</pre><h4>App.vue</h4><p>Delete the default content after installing Vue and replace it with a Gmap Web Component.</p><pre>&lt;script setup&gt;<br>import &#39;./web-components/wc-gmap&#39;;<br>&lt;/script&gt;<br><br>&lt;template&gt;<br>  &lt;wc-gmap<br>      width=&quot;800px&quot;<br>      height=&quot;300px&quot;<br>      lat=&quot;37.7749&quot;<br>      lng=&quot;-122.4194&quot;<br>      zoom=&quot;12&quot;<br>      apiKey=&quot;YOUR_API_KEY&quot;<br>      markers=&#39;[<br>      {&quot;lat&quot;: 37.7749, &quot;lng&quot;: -122.4194, &quot;title&quot;: &quot;San Francisco&quot;},<br>      {&quot;lat&quot;: 37.7912, &quot;lng&quot;: -122.3920, &quot;title&quot;: &quot;Google - 345 Spear St&quot;},<br>      {&quot;lat&quot;: 37.7898, &quot;lng&quot;: -122.3942, &quot;title&quot;: &quot;Airbnb - 888 Brannan St&quot;},<br>      {&quot;lat&quot;: 37.7894, &quot;lng&quot;: -122.4018, &quot;title&quot;: &quot;Uber - 1455 Market St&quot;},<br>      {&quot;lat&quot;: 37.7896, &quot;lng&quot;: -122.3908, &quot;title&quot;: &quot;Pinterest - 651 Brannan St&quot;}<br>  ]&#39;/&gt;<br>&lt;/template&gt;</pre><h4>Result in Browser</h4><p>Map displayed on a running <strong>Vue 13 library</strong> on <strong>localhost:5173</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*PR-oBQnxZ57TQq7RK9DahA.png" /><figcaption>Web Component wc-gmap in Vue 3.4.29</figcaption></figure><h3>Conclusion</h3><p>The goal of this article was to demonstrate the power of native Web Components because we can implement them in all web frameworks and libraries, including native HTML. By no means am I suggesting the exclusive use of Web Components, but in some cases, they are a more suitable solution.</p><h4>Follow me on LinkedIn</h4><p><a href="https://www.linkedin.com/in/gasparikm/">https://www.linkedin.com/in/gasparikm/</a></p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b24ead4bb3bd" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/create-your-own-web-component-and-implement-it-in-react-angular-or-vue-b24ead4bb3bd">Create Your Own Web Component and Implement It in React, Angular, or Vue</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of JavaScript: Fixing JS Date with JS Temporal]]></title>
            <link>https://blog.stackademic.com/the-future-of-javascript-fixing-js-date-with-js-temporal-de162bc0f8c8?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/de162bc0f8c8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 11:23:26 GMT</pubDate>
            <atom:updated>2024-09-30T03:07:51.256Z</atom:updated>
            <content:encoded><![CDATA[<h4>Correction and improvement of working with time in JS Date using JS Temporal (Stage 3 Candidate) in practical sandbox</h4><h3>Introduction</h3><p>Almost everyone who has worked with JavaScript for some time has encountered various issues. Temporal, like Date or Math, will be a global object (top-level namespace). You can also read about the motivation behind the creation of Temporal in this article — <a href="https://maggiepint.com/2017/04/09/fixing-javascript-date-getting-started/">Fixing JavaScript Date</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4YgI-8DnE0jKB8vCyvQQQ.png" /><figcaption><a href="https://tc39.es/">TC39</a> is a collective of JavaScript developers, implementers, academics, and others who work together with the community to maintain and advance the definition of JavaScript.</figcaption></figure><p>JavaScript Temporal promises to revolutionize how developers handle date and time operations, addressing long-standing issues with the existing Date object. With its robust API, first-class support for time zones, and precise handling of dates and times, Temporal offers a powerful and intuitive solution for serious development.</p><h3>Problem Solving List</h3><p>Temporal should mainly solve these problems:</p><ul><li>Providing user-friendly APIs for date and time calculations</li><li>Offering first-class support for all time zones, including DST-safe arithmetic</li><li>Handling objects that represent fixed dates and times exclusively</li><li>Parsing strictly defined string formats</li><li>Supporting non-Gregorian calendars</li></ul><h3>Pollyfils</h3><p>There two relevant polyfills that more or less adhere to the Temporal API proposal.</p><h4>js-temporal/polyfill</h4><p><em>Strict compliance for entire API.</em></p><p><strong>Npm package: </strong>@js-temporal/polyfill</p><p><a href="https://www.npmjs.com/package/@js-temporal/polyfill">https://www.npmjs.com/package/@js-temporal/polyfill</a></p><p><strong>Repo:</strong> <a href="https://github.com/js-temporal/temporal-polyfill">js-temporal/temporal-polyfill</a></p><p><strong>Creators:</strong> Champions of the <a href="https://github.com/tc39/proposal-temporal">Temporal proposal</a></p><h4>temporal-polyfill</h4><p><em>Strict compliance for built-in types. Relaxed compliance for subclassing built-in types.</em></p><p><strong>Npm package:</strong> temporal-polyfill</p><p><a href="https://www.npmjs.com/package/temporal-polyfill">https://www.npmjs.com/package/temporal-polyfill</a></p><p><strong>Repo:</strong> <a href="https://github.com/fullcalendar/temporal-polyfill">fullcalendar/temporal-polyfill</a></p><p><strong>Creators:</strong> <a href="https://fullcalendar.io/">FullCalendar</a> lead dev <a href="https://github.com/arshaw">arshaw</a></p><h3>NPM Trends Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sE7sQbiHX5ZZ_WXU7fSbng.png" /><figcaption><a href="https://npmtrends.com/@js-temporal/polyfill-vs-temporal-polyfill">https://npmtrends.com/@js-temporal/polyfill-vs-temporal-polyfill</a></figcaption></figure><h3>Initial Sandbox Project</h3><p>In this example, we will use @js-temporal/polyfill because it ensures strict compliance for the entire API.</p><p>In the first step, we will initialize the project. We can create a directory, for example, js-temporal-sandbox, and run the command npm init in the command line. This is how the initialization for the project might look. Don&#39;t forget to set the property type to module (ES Module). For complete simplicity, we could define package.json like this:</p><pre>{<br>  &quot;name&quot;: &quot;js-temporal-sandbox&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node temporal-sandbox.js&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;@js-temporal/polyfill&quot;: &quot;^0.4.4&quot;,<br>  }<br>}</pre><h3>Install Temporal Api Polyfill</h3><p>Since JavaScript Temporal is still in the proposal stage, it is not yet natively available in JavaScript, so we need to install Temporal as a polyfill.</p><pre>npm install @js-temporal/polyfill --save</pre><h4>File Structure</h4><pre>├── js-temporal-sandbox<br>│   ├── node_modules<br>│   ├── package.json<br>│   └── temporal-sandbox.js</pre><h4>Get Current Time</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const date = Temporal.Now.plainDateISO();<br><br>// returns the date in ISO 8601 date format<br>console.log(date.toString());  // 2024-05-31<br></pre><pre>npm start<br><br>2024-05-31</pre><h4>Unix TimeStamp</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const timeStamp = Temporal.Now.instant();<br><br>console.log(timeStamp.toString()); // 2024-05-31T18:27:42.958062946Z</pre><pre>npm start<br><br>2024-05-31T18:27:42.958062946Z</pre><h4>Unix TimeStamp Seconds and Miliseconds</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const timeStamp = Temporal.Now.instant();<br><br>console.log(timeStamp.epochMilliseconds); // 1717180609044<br>console.log(timeStamp.epochSeconds); // 1717180609</pre><pre>npm start<br><br>1717180609044<br>1717180609</pre><h4>On Which Day Will John Doe Have His Birthday?</h4><p>Imagine that John Doe was born on August 12, 1990. We can also find out on which day he will celebrate his birthday in 2029 like this:</p><p>An example of combining a day on the calendar (Temporal.PlainMonthDay) and a year into a Temporal.PlainDate.</p><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const birthday = Temporal.PlainMonthDay.from(&#39;08-12&#39;);<br>const birthdayIn2029 = birthday.toPlainDate({ year: 2029 });<br><br>console.log(birthdayIn2029.dayOfWeek); // 7</pre><pre>npm start<br><br>7</pre><h4>UTC Offset as a String</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const instant = Temporal.Instant.from(&#39;2024-05-31T00:00Z&#39;);<br>const timeZone = Temporal.TimeZone.from(&#39;Europe/Berlin&#39;);<br><br>console.log(timeZone.getOffsetStringFor(instant)); // &#39;+02:00&#39;<br><br>// can also be done with ZonedDateTime.offset:<br>const source = instant.toZonedDateTimeISO(timeZone);<br><br>console.log(source.offset); // &#39;+02:00&#39;</pre><pre>npm start<br><br>+02:00</pre><h4>Flight Arrival/Departure and Duration</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>// Departure: Hong Kong time zone<br>const departure = Temporal.ZonedDateTime.from(<br>  &#39;2024-08-12T11:55:00+08:00[Asia/Hong_Kong]&#39;<br>);<br><br>// Arrival: Los Angeles time zone<br>const arrival = Temporal.ZonedDateTime.from(<br>  &#39;2024-08-12T09:50:00-07:00[America/Los_Angeles]&#39;<br>);<br><br>// Calculate flight time (Duration) using `since` method<br>const flightTime = arrival.since(departure, { largestUnit: &#39;hours&#39; });<br><br>// Log the flight duration in hours and minutes<br>console.log(`Flight Time: ${flightTime.hours} hours and ${flightTime.minutes} minutes.`);<br><br>// Output: Flight Time: 11 hours and 55 minutes<br>// Considering the time zone difference.</pre><pre>npm start<br><br>11<br>55</pre><h4>Unit-constrained Duration Between Now and a Past/Future</h4><pre>import { Temporal } from &quot;@js-temporal/polyfill&quot;;<br><br>const result = Temporal.Instant.from(&#39;2024-06-01T04:00Z&#39;)<br>.since(Temporal.Instant.from(&#39;2024-06-01T00:00Z&#39;), {<br>    largestUnit: &#39;hour&#39;<br>});<br><br>console.log(result.days);<br>console.log(result.hours);<br>console.log(result.minutes);<br>console.log(result.toJSON());<br><br>const result2 = Temporal.Instant.from(&#39;2024-06-01T04:00Z&#39;)<br>.since(Temporal.Instant.from(&#39;2024-06-01T00:00Z&#39;), {<br>    largestUnit: &#39;minutes&#39;<br>});<br><br>console.log(result2.toJSON());</pre><pre>npm start<br><br>0<br>4<br>0<br>PT4H<br>PT240M</pre><h3>Conclusion</h3><p>In this article, we introduced the upcoming JS Temporal and demonstrated how to set it up using polyfills and try out some examples. If you want to explore JS Temporal further, I recommend visiting some of the references I used.</p><p><strong>Do you like JavaScript Temporal? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><h4>References</h4><p><a href="https://tc39.es/proposal-temporal/">https://tc39.es/proposal-temporal/</a></p><p><a href="https://tc39.es/proposal-temporal/docs/cookbook.html">https://tc39.es/proposal-temporal/docs/cookbook.html</a></p><p><a href="https://www.proposals.es/">https://www.proposals.es/</a></p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de162bc0f8c8" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/the-future-of-javascript-fixing-js-date-with-js-temporal-de162bc0f8c8">The Future of JavaScript: Fixing JS Date with JS Temporal</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nano ID: Popular, Secure, and URL-Friendly Unique Identifiers]]></title>
            <link>https://medium.com/@gaspm/nano-id-popular-secure-and-url-friendly-unique-identifiers-1fa86c9fdf7c?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fa86c9fdf7c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Fri, 29 Mar 2024 16:17:14 GMT</pubDate>
            <atom:updated>2024-12-12T13:15:08.769Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is Nano ID and why is it suitable to use this standard for web apps?</h4><p>The truth is, that Nano ID looks much more friendly in URLs when combined with a so-called slug text compared to the UUID. Nano ID is created similarly to <strong>random-based</strong> <strong>UUID v4</strong>, with a similar number of random bits in the ID (126 in Nano ID and 128 UUID), thus having a <strong>comparable collision probability</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuX3m7zMWIDUBHH0omlquw.png" /></figure><blockquote>To gain a clearer grasp, if duplications are a concern, generating <strong>103 trillion</strong> IDs in version 4 is necessary to attain a probability of one in a billion.</blockquote><h3>Comparison of Nano ID and UUID v4</h3><p>Nano ID employs a larger alphabet, allowing the packing of a comparable number of random bits into just 21<strong> symbols</strong> rather than 36. As a result, the Nano ID code is <strong>four times smaller</strong> than the UUID v4 package, comprising 136 bytes instead of 423.</p><h3>What About Security?</h3><p>Nano ID, of course, prioritizes security. It utilizes several significant standards which we will discuss below.</p><h4>Unpredictability</h4><p>This lib uses the crypto module in NodeJs and Web Crypto APIin web browsers. It doesn’t use anything predictable like “Math.random()”.</p><h4><strong>Ingenuity</strong></h4><p>Utilizes a sophisticated algorithm and undergoes testing for uniformity. You can view the complete algorithm <a href="https://github.com/ai/nanoid/blob/main/index.js">here</a>. So it doesn’t exploit a known vulnerability in generation (random % alphabet), reducing the number of brute-forcing attempts.</p><h4>Support</h4><p><a href="https://tidelift.com/docs/security">Tidelift</a> serves as the designated security point of contact for numerous open-source projects.</p><h3>What does the Nano ID look like?</h3><p>Here is an example of what generated Nano IDs look like.</p><pre>// eCsd2NHKc6bb4w-ZD3b1G<br>// bMGJ4vsKbGrrdv-L8Qqmw<br>// XuQHF8cjnqycZPIsqvJpe<br>// bfpX_NcdztmbLW78LXhR3<br>// bbUteXTuC6elaKWKTldMn<br>// _gOIheG92VAZ3UYTIkx6O<br>// XRi0LyTOxJPzj2TaKVfe_<br>// orRgcUctn4egGVtfZg1Gr<br>// USSCyMOFEMyrpoosbgU9X<br>// AwIXnabeTBe4UmA522P60</pre><h3>Installing and Using Nano ID in JavaScript</h3><p>Installation of Nano ID via NPM</p><pre>npm install nanoid</pre><pre>import { nanoid } from &#39;nanoid&#39;;<br>console.log(nanoid()); // output -&gt; &quot;eZ3E_akRVB_MU8KKmmdA8&quot;</pre><h3>Flexibility and Adaptability</h3><h4>ID size</h4><p>Should you wish to decrease the size of the ID (thus increasing the probability of collisions), you have the option to specify the size as an argument.</p><pre>console.log(nanoid(10)); // output -&gt; &quot;vedFhT6co&quot;</pre><blockquote>Remember to verify the security of your ID size using the <a href="https://zelark.github.io/nano-id-cc/">Nano ID Collision Calculator</a>.</blockquote><h3>Nano ID CLI</h3><p>Nano ID has CLI support. Below are a few usage examples.</p><pre>$ npx nanoid<br>Need to install the following packages:<br>nanoid@5.0.6<br>Ok to proceed? (y) y<br>JSagbVIa9IwfdChXLnGT6<br><br>$ npx nanoid<br>4S9SmdQ_OzcDdKUlKbI0e<br><br>$ npx nanoid --size 10<br>D7r7SAjlLj<br><br>$ npx nanoid --size 24<br>Nm55fp7tx3aovty_eTVGbj0n<br><br>$ npx nanoid --alphabet xyz --size 15<br>xzyzyzyyxyzxxxz</pre><h3>Custom Random Bytes</h3><p>Nano ID is very flexible, and we can define our own character palette and ID length.</p><pre>import { customRandom } from &#39;nanoid&#39;;<br><br>const nanoid = customRandom(&#39;uvwxyz&#39;, 10, size =&gt; {<br>  return (new Uint8Array(size)).map(() =&gt; 256 * Math.random()); <br>  // Math.random is used only for testing purposes <br>  // please use a custom function instead.<br>});<br><br>console.log(nanoid()); // output -&gt; &quot;uyvzzwyzzz&quot;</pre><h3>Nano ID Collision Calculator</h3><p>If you want to control or optimize the character count of your IDs for your project, I recommend checking out the <a href="https://zelark.github.io/nano-id-cc/">Nano ID Collision Calculator</a> tool. Using this tool, you can easily determine the probability of at least one collision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*nGgcH-duEXHmWNYN2JTfiQ.png" /><figcaption>Screenshot from the ID collision probability <a href="https://zelark.github.io/nano-id-cc/">calculation tool</a></figcaption></figure><h3><strong>Usability Scale</strong></h3><p>Nano ID can be used in various domains and applications where unique identifiers need to be generated. Some of the possible uses of Nano ID include:</p><h4>Database applications</h4><p>For generating unique identifiers for records in a database.</p><h4>Authentication and security</h4><p>For creating random tokens used in authentication, especially in multi-user systems.</p><h4>Shortened URL addresses</h4><p>For creating short and unique URL addresses for various resources.</p><h4><strong>File or directory name generation</strong></h4><p>For creating unique file or directory names in multi-user systems or file management applications.</p><h4>Identity management applications</h4><p>For creating unique identifiers for users, devices, or other entities in identity management systems.</p><h4>And much more</h4><p>These are just some examples of the use of Nano ID, but there are many other possibilities depending on specific requirements and applications.</p><h3>Growth of Nano ID’s Popularity in the Chart (NPM)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCorAs43X4VjqvSlbHKkHw.png" /><figcaption>In recent years, Nano ID has become incredibly popular. <br>Source: <a href="https://npmtrends.com/nanoid">npmtrends.com</a></figcaption></figure><h3>Nano ID and Programming Languages</h3><p>Nano ID has been adapted for numerous languages, allowing you to employ these adaptations for a consistent ID generation process across client and server environments.</p><p>Below you can see a list of supported languages and technologies.</p><blockquote>C#, C++, Clojure and ClojureScript, ColdFusion/CFML, Crystal, Dart &amp; Flutter, Deno, Elixir, Go, Haskell, Haxe, Janet, Java, JavaScript, Kotlin, MySQL/MariaDB, Nim, OCaml, Perl, PHP, Python, R, Ruby, Rust, Swift, Unison, V, Zig</blockquote><h3>Nano ID Generator Online</h3><p>To generate some Nano IDs quickly, you can use the Nano ID Generator at <a href="https://www.devgyver.tech/nanoid">https://www.devgyver.tech/nanoid</a></p><h3>Follow me on LinkedIn</h3><p>You would make me <strong>incredibly happy</strong> if you followed me on LinkedIn. Thank you for every single <strong>connection</strong> and <strong>follow</strong>. 💓</p><h4>🤜👉 <a href="https://www.linkedin.com/in/gasparikm/">https://www.linkedin.com/in/gasparikm/</a></h4><h4>Reference</h4><p><a href="https://github.com/ai/nanoid">https://github.com/ai/nanoid</a></p><h3>Are You Exploring Alternatives to Nano ID? Consider UUID for Your Project</h3><p>Do you want to learn more about UUIDs? I recommend checking out my article.</p><p><a href="https://medium.com/@gaspm/understanding-uuid-purpose-and-benefits-of-a-universal-unique-identifier-59110154d897">https://medium.com/@gaspm/understanding-uuid-purpose-and-benefits-of-a-universal-unique-identifier-59110154d897</a></p><p><strong>Do you like Nano ID? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fa86c9fdf7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ImageMagick 7: Command Line Interface (CLI) in Practice]]></title>
            <link>https://medium.com/@gaspm/imagemagick-7-command-line-interface-cli-in-practice-a7a50f2adf85?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7a50f2adf85</guid>
            <category><![CDATA[c]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 18:46:04 GMT</pubDate>
            <atom:updated>2024-06-01T18:18:49.332Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple demonstration of how we can use the power of the ImageMagick library with examples</h4><h3>ImageMagick in Nutshell</h3><p>Is an open-source software suite (developed in C language) used for viewing, editing, and converting raster (bitmap) and vector images. It provides a wide range of image manipulation capabilities, making it a powerful tool for working with images in various formats. The initial release of ImageMagick was already in 1990.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVi-O2AjNyn43FeaCEpR8Q.png" /></figure><blockquote>ImageMagick is often used for tasks like image resizing, format conversion, watermarking, and creating thumbnails. It’s a versatile tool for both casual users and professionals working with images.</blockquote><h3>Installation</h3><h4>Linux (Ubuntu) Easy Installation of ImageMagick 7</h4><pre>$ git clone https://github.com/SoftCreatR/imei<br>$ cd imei<br>$ sudo ./imei.sh</pre><h4>macOS</h4><pre>$ brew install imagemagick<br>$ brew install ghostscript</pre><h4>Windows</h4><p><a href="https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-15-Q16-HDRI-x64-dll.exe">https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-15-Q16-HDRI-x64-dll.exe</a></p><h3>Check Version</h3><p>In this case, we will be working with ImageMagick version 7.1.1–15.</p><pre>$ magick -version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*c8k8ePk42p830hoD4sHmxA.png" /></figure><h3>Folder Structure for Experimenting</h3><p>I have a folder named “input” and another one named “output” that are prepared. Within the “input” folder, there is an image named “neom.jpg”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWjIXF3i94SUhZ23_xUpvA.png" /><figcaption>I have a folder called input and output ready</figcaption></figure><h4>Convert Between Formats</h4><pre>$ magick input/neom.jpg output/neom.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JT_rRrX_a6lFHUevHca8Og.png" /><figcaption>image neom.png has been generated</figcaption></figure><h4>Convert + Resize Example</h4><pre>$ magick input/neom.jpg -resize 50% output/neom-resized-50-percent.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PC6O5K2qrLSyHyX0b8Prow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t4nN_r2CQRxvTN0D1LKBkQ.png" /><figcaption>Photo by <a href="https://unsplash.com/@neom?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NEOM</a> on <a href="https://unsplash.com/photos/lrhF4w-KKjA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>neom.jpg -info</em></p><pre>$ magick identify input/neom.jpg<br><br>input/neom.jpg JPEG 1920x1280 1920x1280+0+0 8-bit sRGB 602854B 0.000u 0:00.000</pre><p><em>neom-resized-50-percent.png -info</em></p><pre>$ magick identify output/neom-resized-50-percent.png<br><br>output/neom-resized-50-percent.png PNG 960x640 960x640+0+0 8-bit sRGB 991.293KiB 0.000u 0:00.000</pre><h4>Convert + Grayscale Example</h4><pre>$ magick input/neom.jpg -grayscale Rec709Luma output/neom-grayscale.webp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WptBrlBfznzocs9PUQFIDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEjdPKQrAozu-IPsRnL96g.png" /><figcaption>Photo by <a href="https://unsplash.com/@neom?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NEOM</a> on <a href="https://unsplash.com/photos/lrhF4w-KKjA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>neom-grayscale.webp -info</em></p><pre>$ magick identify output/neom-grayscale.webp<br><br>output/neom-grayscale.webp WEBP 1920x1280 1920x1280+0+0 8-bit sRGB 261892B 0.030u 0:00.028</pre><h4>Convert + Text Example</h4><pre>$ magick input/neom.jpg -fill white -stroke black -pointsize 350 -gravity center -annotate 0 &#39;TEXT&#39; output/neom-text.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T8Buok6wq2do8hjd4qsYlQ.png" /><figcaption>Photo by <a href="https://unsplash.com/@neom?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NEOM</a> on <a href="https://unsplash.com/photos/lrhF4w-KKjA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>neom-text.png -info</em></p><pre>$ magick identify output/neom-text.png<br><br>output/neom-text.png PNG 1920x1280 1920x1280+0+0 8-bit sRGB 3.67644MiB 0.000u 0:00.000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nq6W-ASOwMpjyGegjpAVXg.png" /></figure><h4>Convert + Paint (simulate an oil painting)</h4><pre>$ magick input/neom.jpg -paint 15 output/neom-paint.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvPJGbuMGiE9L2eImKuZuA.png" /><figcaption>Photo by <a href="https://unsplash.com/@neom?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NEOM</a> on <a href="https://unsplash.com/photos/lrhF4w-KKjA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>neom-paint.png -info</em></p><pre>$ magick identify output/neom-paint.png<br><br>output/neom-paint.png PNG 1920x1280 1920x1280+0+0 8-bit sRGB 1.24445MiB 0.000u 0:00.000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmJ02PCus_n5ezdDmhLtww.png" /></figure><h4>Convert and Resize Multiple Images</h4><pre>$ magick mogrify -path output -format webp -resize 500x input/*</pre><p>This command uses mogrify to batch resize all images in the “input” directory. The images will be resized to a width of 500 pixels, saved in the WebP format, and will retain their original names. The resulting images will be stored in the “output” directory with the “.webp” extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n6bCym7-FgK9EEojbcpTYw.png" /><figcaption>On the left, we see the original JPG files, and on the right, they have been resized to a width of 500px and converted to the WebP format.</figcaption></figure><h3>Conclusion</h3><p>This was just a very small demonstration of what ImageMagick can do, just to give you an idea of how it works in a general sense. Please carefully review the official documentation to see the full extent of its capabilities.</p><p>Official webpage, download, and documentation: <a href="https://imagemagick.org/">https://imagemagick.org</a></p><p><strong>Do you like ImageMagick? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7a50f2adf85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Quickly and Easily Generate Mockup Data Using JavaScript and Faker]]></title>
            <link>https://medium.com/@gaspm/how-to-quickly-and-easily-generate-mockup-data-using-javascript-and-faker-67a19c64c8e8?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/67a19c64c8e8</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Sat, 26 Aug 2023 20:01:49 GMT</pubDate>
            <atom:updated>2023-08-29T06:42:41.960Z</atom:updated>
            <content:encoded><![CDATA[<h4>A quick and simple step-by-step guide of how we can efficiently generate a JSON file with mockup data.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QX25E4d3QsheGNL8v8d6yQ.png" /></figure><h3>Project Initialization</h3><p>In the project directory, we must first initialize our project, so we start by running the “npm init” command in the terminal, filling in the required information and then confirming.</p><p>For our project to function properly, let’s not forget to define:</p><pre>&quot;type&quot;: &quot;module&quot;,</pre><p>It is basically used to enable the ES6 modules import/export syntax.</p><h3>Installing Faker.js</h3><pre>npm install @faker-js/faker --save-dev</pre><p>package.json file has been updated, and the @faker-js package has been installed.</p><pre>&quot;devDependencies&quot;: {<br>    &quot;@faker-js/faker&quot;: &quot;^8.0.2&quot;<br>}</pre><p>Now, our file could look like this:</p><pre>{<br>  &quot;name&quot;: &quot;faker-js-playground&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;scripts&quot;: {<br>    ...<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@faker-js/faker&quot;: &quot;^8.0.2&quot;<br>  }<br>}</pre><h3>File Structure</h3><p>We will create two more directories, “generators” and “utils,” into which we will add the files “users.js” and “create-json-file.js” as we can see below.</p><pre>├── generators<br>│   ├── users.js<br>├── utils<br>│   ├── create-json-file.js<br>└── package.json</pre><h3>Example of Data Generation</h3><p>If we’ve already created the “generators” directory and the “users.js” file, we can start writing code. In this example, we will demonstrate how to generate data for users.</p><p>First, we will import the Faker library. Then, we will create a constant called “count” where we will initialize the number of records we want to generate and a constant called “users” that we will initialize as an empty array.</p><pre>import { faker } from &#39;@faker-js/faker&#39;;<br><br>const count = 10;<br>const users = [];</pre><p>In the next step, we will prepare an iteration, a classic “for” loop. Within this loop, we will create a constant called “user” which we will define as an object with values generated by Faker.</p><pre>for (let i = 0; i &lt; count; i++) {<br>    const user = {<br>        id: faker.string.uuid(),<br>        avatar: faker.image.avatarLegacy(),<br>        firstName: faker.person.firstName(),<br>        lastName: faker.person.lastName(),<br>        birthDate: faker.date.birthdate({ min: 18, max: 65, mode: &#39;age&#39; }),<br>        description: faker.lorem.paragraph(),<br>        address: {<br>            street: faker.location.streetAddress({ useFullAddress: true }),<br>            city: faker.location.city(),<br>            country: faker.location.country(),<br>        },<br>        contact: {<br>            email: faker.internet.email(),<br>            phone: faker.phone.number(&#39;+421 91# ### ###&#39;),<br>        }<br>    };<br>    // add user object to users array<br>    users.push(user);<br>}</pre><p>I tried to provide various values to demonstrate the diverse data that Faker can generate. You can find the complete <a href="https://fakerjs.dev/api/">API list</a> on the official Faker.js documentation.</p><h3>Creating a Function for Generating JSON Files</h3><p>We could leave the “users” array to be printed in the console, but I would like to demonstrate a more sophisticated approach to generating this array of objects as a JSON file. Therefore, we will create a special function that will generate it.</p><pre>import fs from &#39;fs&#39;;<br><br>export function createJsonFile(data, filename) {<br><br>    const directoryPath = &#39;./mockup-data&#39;;<br>    const suffix = &#39;json&#39;;<br><br>    if (!fs.existsSync(directoryPath)) {<br>        // Create the directory<br>        fs.mkdirSync(directoryPath);<br>    }<br><br>    // Convert data to JSON string with 2-space indentation<br>    const jsonData = JSON.stringify(data, null, 2);<br>    <br>    // Write file into directory<br>    fs.writeFileSync(`${directoryPath}/${filename}.${suffix}`, <br>    jsonData, &#39;utf-8&#39;);<br>    <br>    console.log(<br>      `The file ${filename}.${suffix} was successfully created!`<br>    );<br><br>}</pre><p>In this example, we have created a simple function that generates a “mockup-data” directory and writes the JSON structure of the &quot;users“ array into it. We will save this code as “create-json-file.js” in the “utils” directory.</p><h3>Call createJsonFile Function</h3><p>Now we need to import the created function and call it at the end of the “users.js” file.</p><pre>...<br>import { createJsonFile } from &#39;../utils/create-json-file.js&#39;;<br><br>...<br><br>    };<br>    users.push(user);<br>}<br><br>createJsonFile(users, &#39;users&#39;); // Call for create users.json file</pre><h3>Run the Mockup Data Generation</h3><p>In the “package.json” file, we will set up the script execution.</p><pre>&quot;scripts&quot;: {<br>    &quot;gen:users&quot;: &quot;node generators/users.js&quot;<br>}</pre><p>The entire “package.json” file could then look like this:</p><pre>{<br>  &quot;name&quot;: &quot;faker-js-playground&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;gen:users&quot;: &quot;node generators/users.js&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@faker-js/faker&quot;: &quot;^8.0.2&quot;<br>  }<br>}</pre><p>Now, you just need to run the command:</p><pre>npm run gen:users</pre><p>After executing this command, a “mockup-data” directory will be created, within which you will find the “users.json” file containing the generated data.</p><pre>├── mockup-data<br>│   ├── users.json</pre><h3>Output</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vd1XEiih7HdFnwaCYtf8vQ.png" /><figcaption>Example of output users.json data</figcaption></figure><h3>Conclusion</h3><p>This was a simple example of how we can set up a mockup data generator based on the Faker library. If you encounter any issues with this tutorial, I have created a <a href="https://github.com/gaspm/faker-js-playground"><strong>GitHub repository</strong></a> with the complete source code. <br>If you’re not familiar with Faker and want to learn more about it, I recommend visiting the <a href="https://fakerjs.dev/">official website</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGqvYaldDD8A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGqvYaldDD8A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGqvYaldDD8A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9992ec56d9bb15b9d618b8f5f1de2ca7/href">https://medium.com/media/9992ec56d9bb15b9d618b8f5f1de2ca7/href</a></iframe><p><strong>Do you like mockup data? Claps 👏, follow, and share on social media.</strong></p><p><em>Thank you for reading until the end. Please consider following the writer and this publication. Visit </em><a href="https://stackademic.com/"><em>Stackademic</em></a><em> to find out more about how we are democratizing free programming education around the world.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67a19c64c8e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decoding the Past: The Purpose of the Computer’s TURBO Button]]></title>
            <link>https://medium.com/@gaspm/decoding-the-past-the-purpose-of-the-computers-turbo-button-5b14249ea1fc?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b14249ea1fc</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[history]]></category>
            <category><![CDATA[90s]]></category>
            <category><![CDATA[retro-gaming]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 19:54:18 GMT</pubDate>
            <atom:updated>2023-08-09T14:38:27.440Z</atom:updated>
            <content:encoded><![CDATA[<h4>Those who remember the 90&#39;s certainly remember the TURBO button. What was it actually for? Unraveling the mystery.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L0-ILr65KSngvSo3X4si3g.png" /><figcaption>Visualization of the Turbo button and current frequency of the processor (digital numbers). The picture was drawn by Michal Gasparik</figcaption></figure><p>Those who grew up in the 90&#39;s like me surely remember the button on the computer case that was placed right next to the reset button. It was called “TURBO”. Many people didn’t know what this button was for, so let’s take a look at it.</p><h3>It All Started with the Intel 8086 Processor</h3><p>In many programs, we need some form of timing. For example, if we want to create a time delay, we need to know how long this delay should last. At that time, all these programs solved this timing issue by using the frequency of the processor for timing purposes.</p><p>Because this processor runs at, let’s say, a frequency of 5MHz, it means that in 1 second, there will be 5 million cycles executed in that processor, during which individual instructions can be executed. And if the program detects that 5 million cycles have elapsed, one second of real-time must have passed. This technique began to be used for timing these programs.</p><h3>A Problem Arose During Further Development</h3><p>Processors like <strong>80x86</strong> (<strong>i386</strong>, <strong>i486</strong> …) started to emerge, and later on, the first Intel Pentium processor. The problem lay in the fact that all these newer processors ran at different frequencies, causing a fundamental issue precisely with timing based on processor speed.</p><p>When we have, for example, a processor with a frequency of 50MHz, it means that 50 million cycles will be executed in 1 second. But if you run a program on it that assumes 5 million cycles are one second, meaning it treats these cycles as one second, in this case, it will actually be 1/10th of a second (0.1s). Since the processor is 10 times faster, everything in that program will be 10 times faster.</p><blockquote>You might think it’s great because all the calculations will now be 10 times faster. However, the point is that not only the calculations will be faster, but everything, literally everything. So, any movement on the screen suddenly became 10 times faster.</blockquote><p>This effect caused all games to be practically unplayable. And just when developers started to realize this problem.</p><p>The TURBO button was created because when the original program was optimized for the original Intel 8086 processor, but you had a processor running at a higher frequency, by pressing the TURBO button, you would lower the processor’s frequency to match the frequency of the original 8086 processor.</p><h3>Big Confusion in the TURBO Button’s Name</h3><p>However, according to the name “TURBO,” people intuitively believed that when they pressed that button, the processor would simply become faster. But because of this issue, some manufacturers started rearranging the functionality of the button. When you pressed the button, the processor ran at its original frequency, and when you pressed it again, the processor slowed down to the frequency of the Intel 8086 processor. This, in practice, caused even greater confusion than before. Therefore, on some computers, displays started to appear, directly showing the frequency of the processor to make it clear at which frequency the processor was currently set.</p><h3>The Final Solution</h3><p>However, the problem was that later on, processors started becoming so fast that the speed of the Intel 8086 processor was extremely low by modern standards. This means that we would have to slow down that processor a hundredfold, for example, just to reach the frequency of the Intel 8086 processor. And that’s why a final solution was devised.</p><blockquote>The processor’s frequency must not be used for timing programs.</blockquote><p>So, all programmers had to start using a different method for timing, other than the processor’s frequency. From this moment until today, real-time clocks are used for timing programs. This means that in practice if you tell the program to wait for one second, it will simply track time and truly wait for one second. It will not bother with how many processor cycles occur in the meantime.</p><p><strong>Do you like 90&#39;s? Claps 👏, follow, and share on social media.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b14249ea1fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Fast Approach to Versioning Highly Agile Frontend Applications in Practice]]></title>
            <link>https://medium.com/bitsrc/a-fast-approach-to-versioning-highly-agile-frontend-applications-in-practice-5bb7f92b54e?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bb7f92b54e</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Fri, 14 Jul 2023 18:50:05 GMT</pubDate>
            <atom:updated>2023-07-31T16:08:01.518Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to create simple custom scripts to generate application time-based versions without using third-party libraries.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZAL_Y8aOqgYmI9PJGh0zQ.png" /></figure><p>This versioning method is more suitable for applications with highly agile development or prototypes with frequent deadlines, to determine which old version is currently deployed on the server.</p><p>This versioning method is not standard but has some significant advantages. For example, it is more readable, and both the developer and the client have a better overview of when the application version was built, allowing them to track when the code changes were last made. Sometimes I come across developers who don’t understand how they should version their applications, so this is probably the easiest way to at least record some version without much effort and in an automated manner.</p><p>Even if you later switch to <strong>Semantic Versioning</strong> or <strong>Calendar Versioning</strong>, keeping this temporal build version will still be beneficial. You never know when it might come in handy, and it is relatively easy to access without causing any harm.</p><p>The following scripts are suitable for all frontend frameworks such as Angular, React, Vue, Svelte, and similar, as they are based on pure JavaScript without the need to install third-party libraries.</p><blockquote><em>💡 </em>Temporal versioning makes sense where the chronological order and release dates of software versions are crucial. If, instead, you want automatic semantic versioning that helps your team independently collaborate on components, and quickly understand the impact of upgrading to a new version based on version number alone, use <a href="https://bit.cloud/"><strong>Bit</strong></a>.</blockquote><h4>Learn More:</h4><p><a href="https://bit.dev/docs/getting-started/collaborate/snap-component-changes/">Snap component changes | Bit</a></p><h3>Example File Structure</h3><pre>└── src<br>    └── app<br>    │   └── environments<br>    │   │   └── version.ts // generated file ts or js<br>    │   ├── version<br>    │   │   ├── version-file-generator.js // version file generator<br>    │   │   └── version-generator.js // version string generator<br>    └── package.json</pre><p><em>Simplified approximate structure of the Angular framework.</em></p><h3>Version String Generator</h3><pre>exports.generate = function() {<br>  const now = new Date();<br>  return formatDate(now);<br>}<br><br>function formatDate(date) {<br>  const year = date.getFullYear();<br>  const month = padZero(date.getMonth() + 1);<br>  const day = padZero(date.getDate());<br>  const hours = padZero(date.getHours());<br>  const minutes = padZero(date.getMinutes());<br><br>  return `${year}.${month}.${day}-${hours}${minutes}`;<br>}<br><br>function padZero(value) {<br>  return value.toString().padStart(2, &#39;0&#39;);<br>}</pre><p><em>version-generator.js</em></p><h3>Version File Generator</h3><pre>const { resolve } = require(&#39;path&#39;);<br>const { writeFileSync } = require(&#39;fs&#39;);<br><br>const version = require(&#39;./version-generator&#39;).generate();<br><br>// set path for created file and choose ts or js suffix<br>const file = resolve(__dirname, &#39;../&#39;, &#39;environments&#39;, &#39;version.ts&#39;);<br><br>writeFileSync(file, `export const VERSION = &#39;${version}&#39;;`);<br><br>console.info(&#39;VERSION&#39;, version);</pre><p><em>version-file-generator.js</em></p><h3>NPM Define Script Version</h3><pre>&quot;scripts&quot;: {<br>  &quot;version&quot;: &quot;node src/version/version-file-generator.js&quot;,<br>},</pre><p><em>package.json</em></p><h3>NPM Run Script Version</h3><pre>$ npm run version<br>&gt; node src/version/version-file-generator.js<br><br>VERSION 2023.07.15-1648</pre><pre>export const VERSION = &#39;2023.07.15-1648&#39;;</pre><p><em>version.ts or version.js — </em>automatically created file</p><pre>import { VERSION } from &#39;./version&#39;;<br><br>export class FooterComponent {<br>  public readonly version: string = VERSION;<br>}</pre><pre>&lt;footer&gt;{{ version }}&lt;/footer&gt;</pre><p><em>example of use in the footer component</em></p><p><strong>Do you like agile time-based versioning? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><h3>Build composable apps with reusable components, just like Lego</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cWt-0jnB86lMZo8R.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong> </strong>is an open-source toolchain for the development of composable software.</p><p>With Bit, you can develop any piece of software — a modern web app, a UI component, a backend service or a CLI script — as an independent, reusable and composable unit of software. Share any component across your applications to make it easier to collaborate and faster to build.</p><p><strong>Join the 100,000+ developers building composable software together.</strong></p><p>Get started with these tutorials:</p><h3>→ Micro-Frontends: <a href="https://youtu.be/zBuBlExo3xA">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Guide</a></h3><h3>→ Code Sharing: <a href="https://youtu.be/9vS86xgG3ak">Video</a> // <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Guide</a></h3><h3>→ Modernization: <a href="https://www.youtube.com/watch?v=c4X1HkFfq1k">Video</a> // <a href="https://blog.bitsrc.io/modernizing-frontend-applications-a-guide-b0bac99be932">Guide</a></h3><h3>→ Monorepo: <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Video</a> // <a href="https://bit.dev/blog/painless-monorepo-dependency-management-with-bit-l4f9fzyw/">Guide</a></h3><h3>→ Microservices: <a href="https://youtu.be/5wxyDLXRho4">Video</a> // <a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Guide</a></h3><h3>→ Design System: <a href="https://youtu.be/YG4kpUXRlG4">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Guide</a></h3><h3>Recommended Articles:</h3><ul><li><a href="https://blog.bitsrc.io/5-ways-to-modernize-your-web-application-3d40fbe9efde">5 Ways to Modernize Your Web Application</a></li><li><a href="https://blog.bitsrc.io/scaling-frontend-applications-in-2023-e455aceff931">Scaling Frontend Applications in 2023</a></li><li><a href="https://blog.bitsrc.io/modernizing-frontend-applications-a-guide-b0bac99be932">Modernizing Frontend Applications: A Guide</a></li><li><a href="https://bit.dev/blog/creating-indepenent-bit-components-in-a-nextjs-project-ljy3mt2y/">Creating Indepenent Bit Components in a NextJS Project</a></li><li><a href="https://bit.dev/blog/theming-react-apps-with-styled-components-and-bit-l7epurug/">Theming React Apps with Styled Components and Bit</a></li><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-to-share-angular-components-between-project-and-apps-5eb0600d99d2">How to Share Angular Components Between Projects and Apps</a></li><li><a href="https://blog.bitsrc.io/getting-started-with-a-new-vue-js-project-in-2023-7ea97498ab6a">Getting Started with a New Vue.js Project in 2023</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bb7f92b54e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/a-fast-approach-to-versioning-highly-agile-frontend-applications-in-practice-5bb7f92b54e">A Fast Approach to Versioning Highly Agile Frontend Applications in Practice</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding UUID: Purpose and Benefits of a Universal Unique Identifier]]></title>
            <link>https://medium.com/@gaspm/understanding-uuid-purpose-and-benefits-of-a-universal-unique-identifier-59110154d897?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/59110154d897</guid>
            <category><![CDATA[uuid]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-tips]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Sat, 10 Jun 2023 11:55:06 GMT</pubDate>
            <atom:updated>2025-05-25T17:09:33.964Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is a UUID, what variants and versions exist, and for what specific purpose each version is suitable?</h4><p>The abbreviation UUID stands for <strong>U</strong>niversal <strong>U</strong>nique <strong>ID</strong>entifier, sometimes also referred to as GUID (<strong>G</strong>lobally <strong>U</strong>nique <strong>ID</strong>entifier). It is a 128-bit integer<strong> </strong>used for data identification in computer systems. UUIDs are generated according to specific standards, which we will discuss, and they are designed to guarantee nearly absolute uniqueness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qyfm0klA8IRLBJzcNxjb3w.png" /></figure><p>Their uniqueness does not depend on coordination between specific parties that generate them. While their uniqueness is not zero, it approaches it so closely that the risk of duplication is highly negligible.</p><p>Therefore, anyone can generate a UUID for their identification needs, with the assurance that this UUID will not match the UUID identifying something else. UUIDs generated by independent parties can, for example, be merged into a single database without causing any duplicate identifiers when merging the data.</p><blockquote>UUID uniqueness is not zero, but it approaches it so closely that the risk of duplication is highly negligible.</blockquote><p>The earliest usage of UUIDs can be traced back to the 1980s when <strong>Apollo computers</strong> employed them in their computing systems. Subsequently, other organizations adopted UUIDs for similar purposes. During that time, UUIDs were typically 64 bits in length.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mruWFwRIgh7V0BTH" /><figcaption>Photo by <a href="https://unsplash.com/@lorenzoherrera?utm_source=medium&amp;utm_medium=referral">Lorenzo Herrera</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>UUID Format</h3><p>UUID has a canonical form of 16 bytes represented as 32 hexadecimal digits (base-16), arranged in 5 groups separated by hyphens, namely 8–4–4–4–12, totaling 36 characters (32 alphanumeric characters and 4 hyphens). As a result, a UUID can appear, for example, like this:</p><pre>8ca0fd81-fd03-438c-8730-c6c4e7ef4aa9</pre><p><em>Two of the characters tell what version and UUID variant it is.</em></p><pre>xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx</pre><h3>UUID Variants</h3><h4><strong>Variant 0</strong></h4><p>This variant is designed for backward compatibility with the now-obsolete Apollo Network Computing System 1.5 UUID format developed around 1988, where the values of N range from 0 to 7.</p><h4><strong>Variant 1</strong></h4><p>This variant, known as RFC 4122/DCE 1.1 UUIDs or “Leach-Salz” UUIDs, is denoted by values of N ranging from 8 to b.</p><h4><strong>Variant 2</strong></h4><p>This variant, characterized in the RFC as “reserved, Microsoft Corporation backward compatibility,” is denoted by values N ranging from c to d. It was specifically utilized for early GUIDs on the Microsoft Windows platform.</p><h4><strong>Variant 3</strong></h4><p>This range, indicated by values of N from e to f, is currently reserved for future use.</p><h3>UUID Versions</h3><h4>UUID Version 1 (time and node based)</h4><p>These are the classical UUIDs, created out of a 60-bit system time, a 14-bit local clock sequence, and a 48-bit system MAC address. The MAC address can be either the real one of a physical network interface card (NIC) or a random multicast MAC address. Version 1 UUIDs are usually used as one-time global unique identifiers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fade174c79832eec027ff2141a9bcc2/href">https://medium.com/media/5fade174c79832eec027ff2141a9bcc2/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2YwWTC0eZvLLEE1QDSZiw.png" /><figcaption>Visualization: time-based UUID 1 segments</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gD3A_HGrLtQ4iawE05sT1w.png" /><figcaption>Visualization: version and variant of UUID</figcaption></figure><p><em>These field names correspond to time-based UUIDs in version 1, but the canonical form of 8–4–4–4–12 is the same for all UUIDs regardless of their generation method.</em></p><h4>Pros of UUID v1</h4><p>Despite the inherent lack of uniqueness in MAC addresses, the risk of collisions in UUIDs remains relatively low. The probability of encountering duplicated UUIDs within the same network system is unlikely. Furthermore, the inclusion of a clock sequence provides an additional layer of protection against duplication.</p><h4>Cons of UUID v1</h4><p>Mainly anonymity, as the MAC address is directly encoded into the UUID, and the possibility to guess clock sequence, if an attacker knows the previous UUIDs, they can easily predict the next ones.</p><p><strong>The recommendation is not to use this UUID for authorization purposes. It can pose a security risk, primarily due to its predictability.</strong></p><h4>UUID Version 2</h4><p>It is not recommended to use. Many UUID implementations omit version 2 due to its shortcomings. In short — issues in the UUIDv2 generation scheme lead to collisions with other generated UUIDv2s.</p><h4>UUID Version 3 (name-based, MD5)</h4><p>These UUIDs, also known as name-based UUIDs, are generated by taking the 128-bit MD5 message digest of a concatenated string consisting of a 128-bit namespace UUID and a name string of any length. These UUIDs are commonly employed when there is a need for repeatable, yet non-unique, message digest identifiers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e4994a2bcc7c98f6d7d4dc4346f25ce/href">https://medium.com/media/0e4994a2bcc7c98f6d7d4dc4346f25ce/href</a></iframe><p>“Pseudocode” for visualizing the generation of UUID version 3</p><pre>uuid3 = md5(namespace + name)</pre><p><em>You can read about the pros and cons of using UUID Version 3 below.</em></p><h4>UUID Version 4 (random data-based) — The Most Popular</h4><p>Are based on random numbers generated from a reliable source of randomness. The structure of a UUID Version 4 consists of 128 bits, represented by 32 hexadecimal digits. Unlike other versions that include specific components derived from certain inputs, UUID Version 4 relies solely on random numbers to create unique identifiers.</p><p>The primary advantage of UUID Version 4 lies in its randomness. Each generated UUID is statistically independent of any other UUID, making collisions highly unlikely. This property makes UUID Version 4 ideal for situations where uniqueness and unpredictability are crucial, such as in cryptographic applications or distributed systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_6eybdOemTxNQmn-D-HTQ.png" /></figure><h4>Pros of UUID v4</h4><p>Not require metadata. This type of UUID is completely random and anonymous. Nearly zero chance of UUID collision.</p><h4>Cons of UUID v4</h4><p>It does not contain any metadata, so in some cases, it may be difficult to discern the context.</p><h4>UUID Version 5 (name-based, SHA-1)</h4><p>These are UUIDs based on the 160-bit SHA-1 message digest of the concatenation of a 128-bit namespace UUID and a name string of arbitrary length. Version 5 UUIDs are usually used for non-unique but repeatable message digest identifiers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac1455966c4b4c1758c890eaee421b49/href">https://medium.com/media/ac1455966c4b4c1758c890eaee421b49/href</a></iframe><p>“Pseudocode” for visualizing the generation of UUID version 5</p><pre>uuid5 = sha1(namespace + name)</pre><h3>When to Use: UUIDv3 vs UUIDv5</h3><p>Which version of UUID is appropriate to use in each case?</p><h4>UUID v3</h4><ul><li>Optimal performance is crucial, especially when system resources are constrained</li><li>When it is not an issue that the original inputs for name and namespace may be known. (less secure MD5 hashing)</li></ul><h4>UUID v5</h4><ul><li>Performance doesn’t matter</li><li>You don’t want the original name and namespace to be known (much secure SHA-1 hashing)</li></ul><h4>Pros of UUID v3, UUID v5</h4><p>No other version of UUID ensures that the input matches the output.</p><h4>Cons of UUID v3, UUID v5</h4><p>Not necessarily a negative, but they still contain both input and output and for maintaining maximum randomness, these versions are not suitable.</p><h3>Special UUIDs</h3><p><strong>Nil UUID — </strong>The “nil” UUID is a unique case representing the UUID 00000000-0000-0000-0000-000000000000, where all the bits are set to zero.</p><p><strong>Omni UUID — </strong>The “omni” UUID is a unique and special case represented by the UUID FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF, where every single bit is set to one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EYlobOPyyR4jVzZL" /><figcaption>Photo by <a href="https://unsplash.com/ko/@tvick?utm_source=medium&amp;utm_medium=referral">Taylor Vick</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Application UUID in the programming world</h3><p>UUIDs have become an essential part of the programming world, offering a range of uses and benefits. Here are some common applications of UUIDs in programming.</p><h4>Database Records</h4><ul><li>Frequent usage as primary keys or distinctive identifiers for database records. They offer a means to distinctly identify and refer to individual data entries, facilitating streamlined data management and retrieval processes.</li></ul><h4>Distributed Systems</h4><ul><li>In distributed systems where multiple nodes or services are involved, UUIDs serve as globally unique identifiers. They help in coordinating and synchronizing data across different components, ensuring consistency and avoiding conflicts.</li></ul><h4>Web Applications</h4><ul><li>These identifiers, such as session IDs, enable secure tracking and management of user sessions by the server. Moreover, they play a crucial role in generating distinct URLs or resource identifiers, guaranteeing resource uniqueness and availability.</li></ul><h4>Data Replication</h4><ul><li>A fundamental role is played by identifiers that ensure the accurate synchronization and integrity of data when replicating between databases or systems. These identifiers enable the identification and matching of corresponding records, ensuring precise alignment and preservation of data integrity.</li></ul><h4>Message Queues and Pub/Sub Systems</h4><ul><li>Valuable in message queues and publish-subscribe systems. They enable message or event tracking and identification, facilitating reliable message processing, ordering, and deduplication.</li></ul><h4>Testing and Mocking</h4><ul><li>Commonly used in software testing and mocking scenarios. They provide unique identifiers for test data, allowing developers to create realistic test environments and simulate various scenarios without conflicts.</li></ul><h4><strong>Security and Access Control</strong></h4><ul><li>Can be used in access control mechanisms, such as generating secure tokens or authorization keys. By using UUIDs, systems can ensure the uniqueness and randomness of generated keys, enhancing security and mitigating the risk of unauthorized access.</li></ul><h3>Conclusion</h3><p>In summary, UUIDs find wide-ranging applications in the programming world, providing unique identifiers, facilitating data synchronization, enabling distributed systems, ensuring data integrity, and enhancing security. Their versatility and uniqueness make them invaluable tools for developers in various domains and programming paradigms.</p><p>Choosing the appropriate UUID version for your use case is crucial to ensure compatibility, uniqueness, and adherence to specific requirements. Whether you require time-based identifiers, secure hashing algorithms, or purely random values, understanding the characteristics and suitability of each UUID version is essential. Consider the unique needs of your application or system to make an informed decision and leverage the power of UUIDs effectively.</p><h3>JavaScript and Native UUID Function</h3><p>randomUUID() is a new method introduced in the ECMAScript 2021 (ES12) standard. It allows generating unique identifiers in the UUID v4 (random data-based).</p><h4>Usage</h4><p>The native randomUUID() function is available on the crypto object in environments that support the latest JavaScript standards (e.g., modern web browsers).</p><pre>const uuid = crypto.randomUUID();<br>console.log(uuid);</pre><pre>3b241101-e2bb-4255-8caf-4136c566a962</pre><h3>Are You Exploring Alternatives to UUID? Consider Nano ID for Your Project</h3><p><a href="https://medium.com/@gaspm/nano-id-popular-secure-and-url-friendly-unique-identifiers-1fa86c9fdf7c">https://medium.com/@gaspm/nano-id-popular-secure-and-url-friendly-unique-identifiers-1fa86c9fdf7c</a></p><p><strong>Do you like UUID? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59110154d897" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are Web Components? How to Create and Implement Them in the Angular Framework]]></title>
            <link>https://medium.com/bitsrc/what-are-web-components-how-to-create-and-implement-them-in-the-angular-framework-76e44d61430a?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/76e44d61430a</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[svelte]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Thu, 04 May 2023 17:59:56 GMT</pubDate>
            <atom:updated>2024-11-28T03:08:11.748Z</atom:updated>
            <content:encoded><![CDATA[<h4>A tutorial on how you can create and implement web components into your Angular app.</h4><p>Web Components are a set of standardized web technologies that allow developers to create reusable components. These components can be used across different web applications, regardless of the underlying framework or technology used (Angular, React, Vue, Svelte…).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxE6LsWVPklVjqXqRU6qRQ.png" /><figcaption>The list of created Web Components can be found at <a href="https://www.webcomponents.org/">https://www.webcomponents.org/</a></figcaption></figure><p>This feature comprises three main technologies: Custom Elements, Shadow DOM, and HTML Templates. Custom Elements allow developers to define new HTML elements, complete with their own encapsulated behavior and properties.</p><p>Shadow DOM provides a way to encapsulate and isolate the styles and markup of a component, preventing interference with other parts of the page. HTML Templates enable developers to define reusable chunks of markup that can be instantiated multiple times with different data.</p><h3>Simple Example of Web Component</h3><pre>class HelloWorldWebComponent extends HTMLElement {<br><br>  constructor() {<br>    super();<br>    this._message= &#39;Hello World, from Web Component!&#39;;<br>  }<br><br>  connectedCallback() {<br>    this.render();<br>  }<br><br>  render() {<br>    this.innerHTML = `<br>      &lt;style&gt;<br>        .container {<br>          border: 1px solid #000;<br>          padding: 1rem;<br>        }<br>      &lt;/style&gt;<br>      &lt;div class=&quot;container&quot;&gt;<br>        &lt;h2&gt;${this._message}&lt;/h2&gt;<br>      &lt;/div&gt;<br>    `;<br>  }<br>}<br><br>customElements.define(&#39;wc-hello-world&#39;, HelloWorldWebComponent);</pre><h3>Simple Example of Web Component with Attributes</h3><pre>class AttributesComponent extends HTMLElement {<br>  static get observedAttributes() {<br>    return [&#39;title&#39;, &#39;description&#39;];<br>  }<br><br>  constructor() {<br>    super();<br>  }<br><br>  connectedCallback() {<br>    this.render();<br>  }<br><br>  attributeChangedCallback(name, oldValue, newValue) {<br>    this.render();<br>  }<br><br>  render() {<br>    const title = this.getAttribute(&#39;title&#39;);<br>    const description = this.getAttribute(&#39;description&#39;);<br>    this.innerHTML = `<br>      &lt;div&gt;<br>        &lt;h1&gt;${title}&lt;/h1&gt;<br>        &lt;p&gt;${description}&lt;/p&gt;<br>      &lt;/div&gt;<br>    `;<br>  }<br>}<br><br>customElements.define(&#39;wc-attributes&#39;, AttributesComponent);</pre><blockquote>💡 Note: You can use an open-source platform such as <a href="https://bit.cloud/"><strong>Bit</strong></a> to publish, share and reuse your components. With Bit, you can pack your web components into independent packages, which can be shared and reused across the entire project, helping to maintain consistency in design.</blockquote><blockquote>Moreover, for building web components with Lit or Stencil, Bit provides an integrated dev environment (compiler, tester, linter, documentation, CI, dev server, and packaging/dependency management/bundler all-in-one).</blockquote><h4>Learn more here:</h4><ul><li><a href="https://bit.dev/blog/introducing-lit-component-development-environment-lfhd699k/">Introducing Lit Component Development Environment</a></li><li><a href="https://bit.dev/blog/introducing-stencil-component-development-environment-lfs5dfqw/">Introducing Stencil Component Development Environment</a></li></ul><h3>Life Cycle Callbacks</h3><p>Similar to Angular Lifecycle hooks, Web Components also have their own Life Cycle Callbacks.</p><p><strong>connectedCallback()</strong> — called by the browser when a custom element is added to the DOM</p><p><strong>disconnectedCallback()</strong> — ensures that any resources or listeners associated with a custom element are properly cleaned up when the element is removed from the DOM, avoiding memory leaks or other issues.</p><pre>class IntervalWebComponent extends HTMLElement {<br>  constructor() {<br>    super();<br>    this._interval = null;<br>  }<br><br>  // Called when custom element is added to the DOM<br>  connectedCallback() {<br>    this._interval = setInterval(() =&gt; {<br>      console.log(&quot;Hello, World!&quot;);<br>    }, 1000);<br>  }<br><br>  // Called when custom element is added to the DOM<br>  disconnectedCallback() {<br>    clearInterval(this._interval);<br>    console.log(&quot;Cleanup complete!&quot;);<br>  }<br>}<br><br>customElements.define(&quot;wc-interval&quot;, IntervalWebComponent);</pre><p><strong>attributeChangedCallback() </strong>— method is called each time a custom element’s defined attribute is added, removed, or changed. It is commonly used to update the state or appearance of the component in response to attribute changes.</p><pre>class AttributeChangedWebComponent extends HTMLElement {<br>  static get observedAttributes() {<br>    return [&#39;message&#39;];<br>  }<br><br>  constructor() {<br>    super();<br>    this._message = &quot;Hello, World!&quot;;<br>  }<br><br>  connectedCallback() {<br>    this.render();<br>  }<br><br>  attributeChangedCallback(name, oldValue, newValue) {<br>    if (name === &#39;message&#39; &amp;&amp; oldValue !== newValue) {<br>      this._message = newValue;<br>      this.render();<br>    }<br>  }<br><br>  render() {<br>    this.innerHTML = `&lt;p&gt;${this._message}&lt;/p&gt;`;<br>  }<br>}<br><br>customElements.define(&quot;wc-attribute-changed&quot;, AttributeChangedWebComponent);</pre><p><strong>adoptedCallback() — </strong>method is called each time a custom element is moved to a new document, and is commonly used to update the component’s state or perform any necessary cleanup or initialization tasks.</p><pre>class AdoptedWebComponent extends HTMLElement {<br>  constructor() {<br>    super();<br>    this._message = &quot;Hello, World!&quot;;<br>  }<br><br>  connectedCallback() {<br>    this.render();<br>  }<br><br>  adoptedCallback() {<br>    console.log(&quot;Component adopted to a new document.&quot;);<br>    this.render();<br>  }<br><br>  render() {<br>    this.innerHTML = `&lt;p&gt;${this._message}&lt;/p&gt;`;<br>  }<br>}<br><br>customElements.define(&quot;wc-adopted&quot;, AdoptedWebComponent);</pre><h3>How to import Web Components into the Angular framework?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m9MHjko14wabEXtQyaRu6w.png" /></figure><p>Add CUSTOM_ELEMENTS_SCHEMA to app.module.ts</p><pre>import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from &#39;@angular/core&#39;;<br>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br><br>import { AppRoutingModule } from &#39;./app-routing.module&#39;;<br>import { AppComponent } from &#39;./app.component&#39;;<br><br>@NgModule({<br>  declarations: [<br>    AppComponent<br>  ],<br>  imports: [<br>    BrowserModule,<br>    AppRoutingModule<br>  ],<br>  providers: [],<br>  bootstrap: [AppComponent],<br>  // Add this line to enable the addition of Web Components.<br>  schemas: [CUSTOM_ELEMENTS_SCHEMA],<br>})<br>export class AppModule { }</pre><p>Create a folder web-components in src/app and a file named hello-world.web-component.js and copy this content:</p><pre>class HelloWorldWebComponent extends HTMLElement {<br><br>  constructor() {<br>    super();<br>    this._message= &#39;Hello World, from Web Component!&#39;;<br>  }<br><br>  connectedCallback() {<br>    this.render();<br>  }<br><br>  render() {<br>    this.innerHTML = `<br>      &lt;style&gt;<br>        .container {<br>          border: 1px solid #000;<br>          padding: 1rem;<br>        }<br>      &lt;/style&gt;<br>      &lt;div class=&quot;container&quot;&gt;<br>        &lt;h2&gt;${this._message}&lt;/h2&gt;<br>      &lt;/div&gt;<br>    `;<br>  }<br>}<br><br>customElements.define(&#39;wc-hello-world&#39;, HelloWorldWebComponent);</pre><p>Import Web Component to AppComponent</p><pre>import { Component } from &#39;@angular/core&#39;;<br><br>// import Web Components<br>import &#39;./web-components/hello-world.web-component&#39;;<br><br>@Component({<br>  selector: &#39;app-root&#39;,<br>  templateUrl: &#39;./app.component.html&#39;,<br>  styleUrls: [&#39;./app.component.scss&#39;]<br>})<br>export class AppComponent {}</pre><p>Add Web Component tag (wc-hello-world) into app.component.html</p><pre>&lt;wc-hello-world&gt;&lt;/wc-hello-world&gt;</pre><p>See the result :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YP5zqkQ7jpLyrtVV_8mxhA.png" /></figure><p><strong>Check also:</strong><br><a href="https://medium.com/@gaspm/create-your-own-web-component-and-implement-it-in-react-angular-or-vue-b24ead4bb3bd">https://medium.com/@gaspm/create-your-own-web-component-and-implement-it-in-react-angular-or-vue-b24ead4bb3bd</a></p><h3>Follow me on LinkedIn</h3><p>You would make me <strong>incredibly happy</strong> if you followed me on LinkedIn. Thank you for every single <strong>connection</strong> and <strong>follow</strong>. 💓</p><h4>🤜👉 <a href="https://www.linkedin.com/in/gasparikm/">https://www.linkedin.com/in/gasparikm/</a></h4><p><strong>Do you like Angular and Web Components? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><h3>Build Angular Apps with reusable components, just like Lego</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Ypoz4f_p4cYWar2T.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong>’s open-source tool </strong>help 250,000+ devs to build apps with components.</p><p>Turn any UI, feature, or page into a <strong>reusable component</strong> — and share it across your applications. It’s easier to collaborate and build faster.</p><p><a href="https://bit.dev/docs/angular-introduction#-learn-angular-with-bit-">Introduction to Angular | Bit</a></p><p><strong>→ </strong><a href="https://bit.cloud/teambit/angular/content/angular-overview"><strong>Learn more</strong></a></p><p>Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:</p><h3>→ <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Micro-Frontends</a></h3><h3>→ <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Design System</a></h3><h3>→ <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Code-Sharing and reuse</a></h3><h3>→ <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Monorepo</a></h3><h3>Learn more:</h3><ul><li><a href="https://bit.dev/blog/introducing-angular-component-development-environment-lfhd699k">Introducing Angular Component Development Environment</a></li><li><a href="https://blog.bitsrc.io/10-useful-angular-features-youve-probably-never-used-e9e33f5c35a7">10 Useful Angular Features You’ve Probably Never Used</a></li><li><a href="https://blog.bitsrc.io/top-8-tools-for-angular-development-in-2023-a99d9f3a2e4e">Top 8 Tools for Angular Development in 2023</a></li><li><a href="https://blog.bitsrc.io/getting-started-with-a-new-angular-project-in-2023-c6ae93facbd6">Getting Started with a New Angular Project in 2023</a></li><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-to-share-angular-components-between-project-and-apps-5eb0600d99d2">How to Share Angular Components Between Projects and Apps</a></li><li><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">How we Build a Component Design System</a></li><li><a href="https://blog.bitsrc.io/creating-a-developer-website-with-bit-components-3f4083a7f050">Creating a Developer Website with Bit components</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76e44d61430a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/what-are-web-components-how-to-create-and-implement-them-in-the-angular-framework-76e44d61430a">What are Web Components? How to Create and Implement Them in the Angular Framework</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Became an Angular Developer, and Why I Have No Plans to Change It]]></title>
            <link>https://medium.com/@gaspm/my-journey-in-web-development-why-i-became-an-angular-developer-and-why-i-have-no-plans-to-change-it-2e00ea9736e3?source=rss-87a7674fbbc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e00ea9736e3</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Michal Gasparik]]></dc:creator>
            <pubDate>Sun, 30 Apr 2023 19:40:11 GMT</pubDate>
            <atom:updated>2024-08-07T08:14:16.464Z</atom:updated>
            <content:encoded><![CDATA[<p>My journey with web development began in 2003 when HTML and CSS were the primary focus of front-end development. Back then, JavaScript was primarily used as a tool to support simple page dynamics and animations. I even remember the times when JavaScript was mostly blocked by browsers, so front-end development was very limited.</p><p><em>If you want to find out more about my absolute beginnings in web development, read the </em><a href="https://medium.com/@gaspm/my-developer-journey-part-2-my-first-web-e06fdd0bb06a"><em>following article</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8TKdV-nRuq0ZiNgmZdWAhQ.png" /></figure><p>In 2006, the jQuery library was released, and it quickly became a game-changer in front-end development. It provided a powerful set of tools and utilities for developers, which made it easier to build complex and interactive web applications. The popularity of jQuery grew rapidly, and numerous plugins and libraries began to emerge, providing developers with an extensive ecosystem of resources to draw upon.</p><p>Personally, I started using jQuery in 2007, and it was mainly for building various plugins, such as sliders, galleries, and accordions. The flexibility and ease of use offered by jQuery allowed me to create dynamic and responsive interfaces for my projects quickly.</p><p>It was an excellent tool that simplified front-end development, even when it came to working with AJAX technology.</p><p>Later in my career, I encountered a challenging e-commerce project. I was tasked with building certain parts of the website using a decoupled architecture. In this setup, the back-end was built using Perl and TT2, while the front-end relied on an API to retrieve data asynchronously via Ajax jQuery.</p><p>As the project began to grow in complexity, I started to realize that without a well-structured and logical JavaScript codebase, the project would not be sustainable in the long run.</p><p>My colleague developed a banking application using ExtJS, but I wasn’t familiar with the framework nor interested in it. The main focus for me was on creating a sustainable structure for the application on the JavaScript side, and to some extent, I was successful.</p><p>In 2009, the Mustache.js and later Handlebars template systems were released, which I found to be very useful in separating “HTML code” from JavaScript logic. This made it easier to maintain and modify the codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pBeHOWPwYgMdN0wrajuCg.png" /></figure><p>I used this library for a long time on various projects even after angular.js and later react.js were released.</p><p>I was also programming in the Laravel framework in 2014, but I still stuck to my JS structure that worked for me, and I didn’t get lost in it.</p><p>Angular.js and React.js seemed strange to me and I couldn’t get a feel for them. It still didn’t look very professional so I had no motivation to learn these libs.</p><h3>The big change that occurred in September 2016 was significant for me and the front-end development community.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O3LVZXoP4Z5AK8Hn7r7Kkw.png" /><figcaption>The first release of TypeScript was already in 2012, but Angular 2 greatly helped its popularity</figcaption></figure><p>Since I had experience working on projects in Laravel and appreciated its code and structure, I became interested when I heard that Angular 2 was going to be released. At the time I was working for a company where it was decided that we were going to learn this new technology.</p><p>I was glad because TypeScript appeared more professional than plain JavaScript without type control, and Angular 2 seemed like a Laravel-like framework for the front-end.</p><blockquote>Learning Angular and its structure along with RxJS was a challenging experience, but I found it to be rewarding, and I don’t have any regrets about the effort I invested in it.</blockquote><p>Later, I worked for a large corporation that had extensive projects, where at times, 4–5 people worked on the front-end simultaneously. For such a collaborative effort on a large-scale project, a well-defined coding style and rules were essential. This is where the Angular framework comes in handy.</p><p>Recently, I almost had a wrangle with a friend who claims that Angular is an absolute prison for web development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H5ZdM7iCKz_pimhy8pYuqg.png" /></figure><p><strong>While it’s true that Angular enforces a strict structure and rules, it’s not a prison for web development. In fact, it can greatly improve code quality and maintainability. I love Angular because it enforces high-quality code with a well-defined structure and rules. Its architecture is based on components, directives, pipes, services, and modules, with a consistent folder and file structure. This makes it easier to collaborate on large projects and maintain code over time.</strong></p><p>When a developer encounters a project that has already been developed before, they can quickly orient themselves in the code and, most likely, in the business logic as well.</p><p>Angular’s advantage is its well-defined structure, making it easier to maintain the project, unlike React where developers have more freedom to write code as they see fit.</p><p>Angular has a high-quality coding style guide that the vast majority of developers follow, making it the most suitable framework for developing robust applications, especially in big tech companies.</p><p>While chatting with my friend on Signal and debating the merits of React vs. Angular, I asked another developer to comment on the matter. He offered a wise and diplomatic response, which I will now quote.</p><blockquote>Angular hides a lot of background complexity behind its abstractions, so one can focus more on the business logic than the technology, which I think is more productive. Plus it sets some barriers that help keep at least some standard in the otherwise very chaotic world of frontend development.</blockquote><p>These words are so valuable to me that they are worth carving into an imaginary stone.</p><h3>Why is Angular losing popularity lately compared to React or Vue?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQFDBep3GpA1T3ITA5H6lg.png" /></figure><p>The answer is simple. Through conducting numerous technical interviews and research, I have found that Angular can be challenging for many JavaScript developers to learn. The use of TypeScript and RxJS data streams can be difficult to fully comprehend.</p><p>This is not to say that React or Vue are entirely bad, but they are more suitable for beginners or developers who prefer a simpler approach to front-end development.</p><p>It is a fact that many companies struggle to find skilled Angular developers, leading them to opt for easier frameworks such as React or Vue. This is not a baseless claim; it is a reality within the software development industry.</p><p>Big tech companies often choose Angular because of the advantages mentioned earlier, particularly for developing large-scale applications, such as information systems, banking, and insurance. Several top companies, including Microsoft Office, Deutsche Bank, Gmail, Forbes, PayPal, Samsung, and more, use Angular.</p><p>While React and Vue can be good replacements for startups or rapid application prototyping, they may not be suitable for more complex and structured projects. Additionally, many companies struggle to find skilled Angular developers, which makes them more likely to choose easier frameworks like React or Vue.</p><p>Personally, I don’t prefer React or Vue code because they remind me of my early day&#39;s scripting in JS.</p><h3>How come I don’t mind that Angular is losing popularity?</h3><p>I’m not bothered by Angular’s decreasing popularity. In fact, I’m glad because it means that Angular developers will become more sought after, and their skills will be more valuable. Although there’s already a sufficient number of React and Vue developers, the market lacks experienced and highly skilled Angular developers. This scarcity of talent could work to the advantage of Angular developers in terms of negotiating better salaries.</p><p>I have been working with Angular since its beta version was released in 2016, and I have no plans to change it in the near future. Thank you to all the Angular contributors, and I believe that it will continue to develop in the right direction in the coming period.</p><h3>Follow me on LinkedIn</h3><p><a href="https://www.linkedin.com/in/gasparikm/">https://www.linkedin.com/in/gasparikm/</a></p><p><strong>Do you like Angular? Claps </strong>👏<strong>, follow, and share on social media.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e00ea9736e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>