<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tomas Stveracek</title>
    <description>The latest articles on Forem by Tomas Stveracek (@tomasdevs).</description>
    <link>https://forem.com/tomasdevs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1205271%2F1128ffb4-9a98-4942-98da-e0e64fee0b97.png</url>
      <title>Forem: Tomas Stveracek</title>
      <link>https://forem.com/tomasdevs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tomasdevs"/>
    <language>en</language>
    <item>
      <title>Testing HTTP/1.1, HTTP/2, and HTTP/3 Performance with a React App</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Sat, 13 Dec 2025 15:08:43 +0000</pubDate>
      <link>https://forem.com/tomasdevs/testing-http11-http2-and-http3-performance-with-a-react-app-67o</link>
      <guid>https://forem.com/tomasdevs/testing-http11-http2-and-http3-performance-with-a-react-app-67o</guid>
      <description>&lt;p&gt;Ever wondered how much faster HTTP/3 really is compared to HTTP/1.1? I built a simple web app to find out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick HTTP History
&lt;/h2&gt;

&lt;p&gt;HTTP/1.1 (1997) - One request per connection. Want 50 images? Open multiple TCP connections and wait. Head-of-line blocking is a real problem. HTTP/2 (2015) - Multiplexing! Multiple requests over single TCP connection. Binary protocol, header compression (HPACK). Big improvement. HTTP/3 (2022) - Uses QUIC over UDP instead of TCP. No more TCP head-of-line blocking. 0-RTT connection resumption. Built-in encryption.&lt;/p&gt;

&lt;h2&gt;
  
  
  The App
&lt;/h2&gt;

&lt;p&gt;I created &lt;a href="https://http-protocol-testing.tomas-stveracek.workers.dev/" rel="noopener noreferrer"&gt;HTTP Protocol Performance Testing&lt;/a&gt; to measure real differences between protocols.&lt;/p&gt;

&lt;h3&gt;
  
  
  What It Measures
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;TTFB (Time to First Byte)&lt;/li&gt;
&lt;li&gt;DOM Load Time&lt;/li&gt;
&lt;li&gt;Full Page Load&lt;/li&gt;
&lt;li&gt;Total Transfer Size&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Test Scenarios
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Baseline - 5 images (minimal difference expected)&lt;/li&gt;
&lt;li&gt;Large Files - 35 images (HTTP/2 should be faster)&lt;/li&gt;
&lt;li&gt;Multiplexing - 50 small images (HTTP/2 and HTTP/3 shine here)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How to Test Each Protocol
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/3: Visit the live demo (Cloudflare serves HTTP/3 by default)&lt;/li&gt;
&lt;li&gt;HTTP/2: Disable QUIC in Chrome (chrome://flags → "QUIC" → Disable)&lt;/li&gt;
&lt;li&gt;HTTP/1.1: Run locally with npm run dev&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;From my testing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/2 shows ~10-50% improvement over HTTP/1.1 (varies by scenario)&lt;/li&gt;
&lt;li&gt;Multiplexing test shows the biggest difference&lt;/li&gt;
&lt;li&gt;HTTP/3 is ~5-15% faster than HTTP/2 on stable networks&lt;/li&gt;
&lt;li&gt;HTTP/3 benefits are more visible on mobile/unstable connections&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;React 19, Vite, Tailwind CSS v4, Chart.js, Cloudflare Workers&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Live Demo: &lt;a href="https://http-protocol-testing.tomas-stveracek.workers.dev/" rel="noopener noreferrer"&gt;https://http-protocol-testing.tomas-stveracek.workers.dev/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/tomasdevs/http-protocol-testing" rel="noopener noreferrer"&gt;https://github.com/tomasdevs/http-protocol-testing&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>http</category>
      <category>performance</category>
      <category>testing</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building a Solar Energy Predictor with React and TensorFlow.js</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Fri, 07 Nov 2025 14:43:32 +0000</pubDate>
      <link>https://forem.com/tomasdevs/building-a-solar-energy-predictor-with-react-and-tensorflowjs-3hom</link>
      <guid>https://forem.com/tomasdevs/building-a-solar-energy-predictor-with-react-and-tensorflowjs-3hom</guid>
      <description>&lt;p&gt;I built a web app that predicts how much energy solar panels can produce based on real weather data and AI predictions. Here's how I did it!&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does It Do?
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Solar Gain Predictor&lt;/strong&gt; calculates solar panel energy production based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Panel area and efficiency&lt;/li&gt;
&lt;li&gt;Roof orientation (south, east, west, etc.)&lt;/li&gt;
&lt;li&gt;Real weather data from your location&lt;/li&gt;
&lt;li&gt;AI predictions trained on 6 months of historical data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React + Vite&lt;/strong&gt; - Fast development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailwind CSS&lt;/strong&gt; - Beautiful design&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chart.js&lt;/strong&gt; - Interactive charts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TensorFlow.js&lt;/strong&gt; - Machine learning in the browser&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open-Meteo API&lt;/strong&gt; - Free weather data (no API key needed!)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenWeatherMap API&lt;/strong&gt; - City search&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Weather Data Challenge
&lt;/h2&gt;

&lt;p&gt;I needed real weather data but didn't want to pay for APIs. I found &lt;strong&gt;Open-Meteo API&lt;/strong&gt; which is completely free and provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;180 days of historical data&lt;/li&gt;
&lt;li&gt;7-day forecasts&lt;/li&gt;
&lt;li&gt;Sunshine duration, cloud coverage, temperature&lt;/li&gt;
&lt;li&gt;No API key required!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For city search, I use OpenWeatherMap's Geocoding API which also returns localized city names (Praha → Prague).&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Predictions with TensorFlow.js
&lt;/h2&gt;

&lt;p&gt;The coolest feature is AI predictions. Here's how it works:&lt;/p&gt;

&lt;h3&gt;
  
  
  Training Data
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Get 180 days of historical weather&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;historicalData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getHistoricalWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Each day contains: month, dayOfYear, temperature, cloudiness, sunHours&lt;/span&gt;

&lt;span class="nx"&gt;Model&lt;/span&gt; &lt;span class="nx"&gt;Architecture&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sequential&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dense&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;activation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;relu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;inputShape&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropout&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dense&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;activation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;relu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropout&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dense&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;activation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;relu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;layers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dense&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;units&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;activation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;linear&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model learns patterns between weather conditions and sun hours. It then predicts the next 5 days and compares with actual forecasts!&lt;/p&gt;

&lt;h2&gt;
  
  
  Internationalization (i18n)
&lt;/h2&gt;

&lt;p&gt;I wanted both Czech and English speakers to use the app, so I added full i18n support:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LanguageContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LanguageProvider&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLanguage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;language&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;translations&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;LanguageContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Provider&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLanguage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/LanguageContext.Provider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even city names are translated! When you search "Praha" in English mode, it shows "Prague, CZ".&lt;/p&gt;

&lt;h2&gt;
  
  
  Rate Limiting for API Protection
&lt;/h2&gt;

&lt;p&gt;Since I use free APIs, I needed to prevent abuse. I added a simple rate limiter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Max 10 requests per minute&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rateLimitMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RATE_LIMIT_MAX_REQUESTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RATE_LIMIT_WINDOW_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkRateLimit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;global&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userRequests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rateLimitMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recentRequests&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;userRequests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;RATE_LIMIT_WINDOW_MS&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;recentRequests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;RATE_LIMIT_MAX_REQUESTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Rate limited&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;recentRequests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;rateLimitMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;recentRequests&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Energy Calculation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The calculation is simple:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;energy (Wh) = area (m²) × efficiency × sun_hours × orientation_factor × 1000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Orientation factors:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;South: 1.0 (100% - optimal)&lt;/li&gt;
&lt;li&gt;Southeast/Southwest: 0.9 (90%)&lt;/li&gt;
&lt;li&gt;East/West: 0.75 (75%)&lt;/li&gt;
&lt;li&gt;North: 0.5 (50%)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Geolocation - One-click location detection&lt;/li&gt;
&lt;li&gt;City autocomplete - Smart search with 300ms debouncing&lt;/li&gt;
&lt;li&gt;Responsive design - Works on mobile and desktop&lt;/li&gt;
&lt;li&gt;Error handling - Fallback to simulated data&lt;/li&gt;
&lt;li&gt;Beautiful UI - Glassmorphism effects with Tailwind CSS&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;This project taught me:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Working with real APIs and handling rate limits&lt;/li&gt;
&lt;li&gt;Machine learning in the browser with TensorFlow.js&lt;/li&gt;
&lt;li&gt;Building a bilingual app (harder than expected!)&lt;/li&gt;
&lt;li&gt;Performance optimization (debouncing, rate limiting)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;Check out the project on GitHub: &lt;a href="https://github.com/TomasDevs/solar-gain-predictor" rel="noopener noreferrer"&gt;https://github.com/TomasDevs/solar-gain-predictor&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;Future ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More weather APIs for better accuracy&lt;/li&gt;
&lt;li&gt;Export predictions to PDF&lt;/li&gt;
&lt;li&gt;Historical comparison (this year vs last year)&lt;/li&gt;
&lt;li&gt;Support for multiple panel configurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What features would you add? Let me know in the comments!&lt;/p&gt;

</description>
      <category>react</category>
      <category>tensorflow</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🌱 Modern CSS Tips &amp; Tricks to Boost Your Workflow</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Fri, 22 Nov 2024 20:14:25 +0000</pubDate>
      <link>https://forem.com/tomasdevs/modern-css-tips-tricks-to-boost-your-workflow-3mp2</link>
      <guid>https://forem.com/tomasdevs/modern-css-tips-tricks-to-boost-your-workflow-3mp2</guid>
      <description>&lt;p&gt;Are you ready to improve your CSS skills with some of the latest tips and tricks? CSS is always changing, and these new features will help you write cleaner, more efficient code while making your websites look great. Here are some useful CSS tips, complete with examples on CodePen that you can try right away!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. 👇 Footer Stuck at the Bottom
&lt;/h2&gt;

&lt;p&gt;Sometimes, content on your page is not enough to push the footer to the bottom of the viewport. You can use this simple CSS solution to make sure the footer stays at the bottom.&lt;br&gt;
Check out the code on &lt;a href="https://codepen.io/tomasdevs/pen/VwooyLX" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. 🧐 Media Queries with Pointer Precision
&lt;/h2&gt;

&lt;p&gt;Make the user experience better by changing your UI based on the type of pointing device. With the &lt;code&gt;pointer&lt;/code&gt; media query, you can adjust styles depending on whether the user has a precise pointer (like a mouse) or a coarse one (like a touchscreen).&lt;br&gt;
Example on &lt;a href="https://codepen.io/tomasdevs/pen/rNXXpzm" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. 💡 The Power of inset
&lt;/h2&gt;

&lt;p&gt;CSS inset is a shorthand for &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;bottom&lt;/code&gt;, and &lt;code&gt;left&lt;/code&gt;. This property is useful for positioning elements easily, making your layout more readable and reducing extra CSS.&lt;br&gt;
See how &lt;code&gt;inset&lt;/code&gt; works in this &lt;a href="https://codepen.io/tomasdevs/pen/GRVVyWz" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. 💥 Using :empty for Placeholder Text
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;:empty&lt;/code&gt; pseudo-class lets you style an element if it has no children. It’s useful for adding placeholder content, like when an image isn’t loaded.&lt;br&gt;
Try it out on &lt;a href="https://codepen.io/tomasdevs/pen/QWeeQEv" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. 🚀 Styling Elements with :where()
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;:where()&lt;/code&gt; pseudo-class is great for applying styles to multiple elements without adding specificity. It’s perfect for resets or for general styling without affecting more specific styles.&lt;br&gt;
See it in action on &lt;a href="https://codepen.io/tomasdevs/pen/abeeqdR" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. 🛠️ Consistent Numeric Width with font-variant-numeric
&lt;/h2&gt;

&lt;p&gt;Do you need numbers to line up perfectly, like in tables or financial data? Use &lt;code&gt;font-variant-numeric: tabular-nums;&lt;/code&gt; to make sure each number takes up the same space, making your data easier to read.&lt;br&gt;
View the example &lt;a href="https://codepen.io/tomasdevs/pen/zYggpeR" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. 💡 Multiline Ellipsis for Overflowing Text
&lt;/h2&gt;

&lt;p&gt;Preventing text overflow and making sure it looks good is important for UI design. You can use &lt;code&gt;-webkit-line-clamp&lt;/code&gt; to limit text to a fixed number of lines and add ellipsis (...). It’s a simple way to handle multiline text overflow.&lt;br&gt;
See how it’s done on &lt;a href="https://codepen.io/tomasdevs/pen/NWQQXbK" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. 🔄 Independent Transform Properties
&lt;/h2&gt;

&lt;p&gt;Instead of writing all transformations &lt;code&gt;(rotate, scale, translate)&lt;/code&gt; together, you can now apply each one separately using new properties like &lt;code&gt;scale&lt;/code&gt;, &lt;code&gt;rotate&lt;/code&gt;, etc. This makes your code easier to read and change.&lt;br&gt;
Check the example on &lt;a href="https://codepen.io/tomasdevs/pen/XWvvVBz" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. 👁️ The :has() Selector as a Parent Selector
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;:has()&lt;/code&gt; selector is like the parent selector we’ve always wanted. You can now style an element based on whether it contains a specific child. This makes dynamic and interactive styling much easier.&lt;br&gt;
Explore the example on &lt;a href="https://codepen.io/tomasdevs/pen/PoMMQwP" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. 🌱 Using System Colors in CSS
&lt;/h2&gt;

&lt;p&gt;CSS system colors let you match your site’s appearance with the user’s operating system or browser theme. This is great for creating visually consistent and accessible websites.&lt;br&gt;
Check out the example &lt;a href="https://codepen.io/tomasdevs/pen/KKOOZyz" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. 🌄 Container Queries for Advanced Responsiveness
&lt;/h2&gt;

&lt;p&gt;With Container Queries, you can style elements based on the size of their container instead of the viewport. This means truly component-driven styling, allowing more flexible and context-aware responsive designs.&lt;br&gt;
See Container Queries in action on &lt;a href="https://codepen.io/tomasdevs/pen/wvVVypd" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. 💧 Set Your Form Styles with accent-color
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;accent-color&lt;/code&gt; property lets you style native form elements like checkboxes and radio buttons easily to match your design. This helps make sure all form elements look consistent.&lt;br&gt;
Check the example &lt;a href="https://codepen.io/tomasdevs/pen/bGXXLvR" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  13. 📏 Responsive Font Size with clamp()
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;clamp()&lt;/code&gt; function is perfect for creating responsive font sizes that adapt to different screen sizes. It lets you set a minimum value, a preferred value, and a maximum value all at once. This ensures the text remains readable on all devices.&lt;br&gt;
Check out the example on &lt;a href="https://codepen.io/tomasdevs/pen/VwooQRe" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;🛠️ Feel free to experiment with the examples on CodePen and see how they can make your CSS more dynamic and elegant. If you have any other modern CSS tips or know about new CSS features, share them in the comments! 📈&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>learning</category>
    </item>
    <item>
      <title>Understanding CORS: Why Your API Requests Are Failing 🚧</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 20 Nov 2024 15:20:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/understanding-cors-why-your-api-requests-are-failing-56ol</link>
      <guid>https://forem.com/tomasdevs/understanding-cors-why-your-api-requests-are-failing-56ol</guid>
      <description>&lt;p&gt;Have you ever made an API request, but it got blocked with a confusing error message about 'CORS'? 😱 Don't worry—you're not alone. Cross-Origin Resource Sharing (CORS) is a common problem for developers, but with some understanding, you'll know why it's happening and how to fix it. Let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is CORS? 🤔
&lt;/h2&gt;

&lt;p&gt;CORS stands for &lt;strong&gt;Cross-Origin Resource Sharing&lt;/strong&gt;. In simple words, it's a security feature used by web browsers to stop harmful behavior. Browsers use &lt;strong&gt;CORS&lt;/strong&gt; to decide if content from one origin (like &lt;em&gt;&lt;a href="https://my-awesome-app.com" rel="noopener noreferrer"&gt;https://my-awesome-app.com&lt;/a&gt;&lt;/em&gt;) can interact with resources from a different origin (like &lt;em&gt;&lt;a href="https://api.something-cool.com" rel="noopener noreferrer"&gt;https://api.something-cool.com&lt;/a&gt;&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;origin&lt;/strong&gt; is defined by the combination of &lt;strong&gt;protocol&lt;/strong&gt; (HTTP or HTTPS), &lt;strong&gt;domain&lt;/strong&gt; (like example.com), and &lt;strong&gt;port&lt;/strong&gt; (e.g., :3000). If any part of this is different between the source of your request and the target API, you're making a &lt;strong&gt;cross-origin request&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does CORS Cause Problems? 🚫
&lt;/h2&gt;

&lt;p&gt;Browsers block these cross-origin requests by default to &lt;strong&gt;protect users&lt;/strong&gt;. Imagine a harmful script on a website trying to interact with another website where you're logged in—it could steal your data without you knowing! CORS prevents this by only allowing safe, approved cross-origin requests.&lt;/p&gt;

&lt;p&gt;When you send an API request across origins, the server needs to tell the browser, "Hey, it’s okay for you to accept this response." If the server doesn’t do this, the browser will block the request and show a &lt;strong&gt;CORS error&lt;/strong&gt;. This is why you might see a message like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;Access to XMLHttpRequest at 'https://api.something-cool.com' from origin 'https://my-awesome-app.com' has been blocked by CORS policy.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Set Up CORS Correctly 🛠️
&lt;/h2&gt;

&lt;p&gt;Now that you understand what CORS is, let's talk about &lt;strong&gt;how to fix it&lt;/strong&gt;. The key lies in the server's response headers. Here are some common CORS headers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Access-Control-Allow-Origin:&lt;/strong&gt; This header tells the browser which domains are allowed to access the server. For example:&lt;br&gt;
Access-Control-Allow-Origin: *&lt;br&gt;
This allows requests from &lt;strong&gt;any origin&lt;/strong&gt;, which is fine for public APIs but not safe for sensitive data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Access-Control-Allow-Methods:&lt;/strong&gt; Specifies which HTTP methods are allowed, like &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, or &lt;code&gt;DELETE&lt;/code&gt;:&lt;br&gt;
&lt;code&gt;Access-Control-Allow-Methods: GET, POST&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Access-Control-Allow-Headers:&lt;/strong&gt; Allows the client to specify which headers can be sent with the request:&lt;br&gt;
&lt;code&gt;Access-Control-Allow-Headers: Content-Type, Authorization&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Access-Control-Allow-Credentials:&lt;/strong&gt; If you need to send cookies or authentication tokens, set this to true:&lt;br&gt;
&lt;code&gt;Access-Control-Allow-Credentials: true&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Practical Example 🚀
&lt;/h2&gt;

&lt;p&gt;Let's say you have a frontend app running at &lt;em&gt;&lt;a href="https://my-frontend.com" rel="noopener noreferrer"&gt;https://my-frontend.com&lt;/a&gt;&lt;/em&gt; and a backend API at &lt;em&gt;&lt;a href="https://api.my-backend.com" rel="noopener noreferrer"&gt;https://api.my-backend.com&lt;/a&gt;&lt;/em&gt;. To allow your app to make requests to your API, you need to configure the CORS settings on your backend.&lt;br&gt;
If you're using &lt;strong&gt;Express.js&lt;/strong&gt; in Node.js, you can set up CORS like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cors&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://my-frontend.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Allow only your frontend&lt;/span&gt;
  &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;// Allow only specific methods&lt;/span&gt;
  &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Allow cookies&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello from the server!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server running on port 3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're allowing requests from &lt;a href="https://my-frontend.com" rel="noopener noreferrer"&gt;https://my-frontend.com&lt;/a&gt;, using GET and POST methods, and allowing credentials like cookies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for Safe CORS Configuration 🛡️
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1) Avoid Using * for Sensitive APIs:&lt;/strong&gt; &lt;code&gt;Setting Access-Control-Allow-Origin: *&lt;/code&gt; is okay for public APIs, but for anything sensitive, always restrict origins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Limit Methods and Headers:&lt;/strong&gt; Be specific about which methods and headers are allowed. The fewer you allow, the less risk there is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Use Credentials Carefully:&lt;/strong&gt; Only enable &lt;code&gt;Access-Control-Allow-Credentials&lt;/code&gt; if your app really needs it. Allowing credentials can increase the risk of CSRF attacks if not handled well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging CORS Issues 🔍
&lt;/h2&gt;

&lt;p&gt;If you're having trouble with CORS, here are some steps to debug:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check the Browser Console:&lt;/strong&gt; The error message will often tell you which header is missing or wrong.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Browser Extensions:&lt;/strong&gt; Chrome and Firefox have extensions like CORS Everywhere to temporarily bypass CORS for development. Just be careful—never use these in production!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test with curl or Postman:&lt;/strong&gt; These tools let you see if the server is responding correctly without browser restrictions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping It Up 🎁
&lt;/h2&gt;

&lt;p&gt;CORS is all about &lt;strong&gt;keeping users safe&lt;/strong&gt; by controlling which resources can be shared across origins. Though it can be frustrating, understanding how to set up CORS correctly can save you a lot of trouble and make sure your API requests work smoothly.&lt;/p&gt;

&lt;p&gt;Next time you see that CORS error, take a deep breath, and remember: it's just the browser protecting your users. With a bit of server-side setup, you'll have it fixed in no time! 😊&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cors</category>
      <category>api</category>
      <category>programming</category>
    </item>
    <item>
      <title>Boost Your Website's Accessibility: Master ARIA Attributes in HTML 🌐</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 13 Nov 2024 15:20:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/boost-your-websites-accessibility-master-aria-attributes-in-html-5d6k</link>
      <guid>https://forem.com/tomasdevs/boost-your-websites-accessibility-master-aria-attributes-in-html-5d6k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Accessibility is Not Just a Trend&lt;/strong&gt; Web accessibility is an important aspect that every frontend developer should care about. It ensures that websites and apps are accessible to all users, including those with disabilities. This is where ARIA (Accessible Rich Internet Applications) attributes come in. Let's learn how to use them correctly to create an accessible and user-friendly web.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is ARIA and Why Use It?
&lt;/h2&gt;

&lt;p&gt;ARIA attributes are special tags that add information for screen readers and other assistive technologies. They help developers make interactive elements more accessible, especially when these elements are not well understood by default. ARIA attributes can provide roles, states, and other properties to components that might not be accessible otherwise.&lt;/p&gt;

&lt;p&gt;Before we start, it’s important to note that &lt;strong&gt;ARIA attributes should not be used on elements that already have their natural role&lt;/strong&gt;. For example, if you use an HTML tag like &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, it already has the role of a button. Adding &lt;code&gt;role="button"&lt;/code&gt; would be unnecessary and even confusing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic ARIA Attributes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. aria-label
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;aria-label&lt;/code&gt; adds a description to an element that otherwise has no understandable text for screen readers. This attribute is ideal for icons or buttons that need a specific description.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Settings"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;⚙️&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bad Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Settings Button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Settings&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- Duplicate text, not needed --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. aria-labelledby and aria-describedby
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;aria-labelledby&lt;/code&gt; works like &lt;code&gt;aria-label&lt;/code&gt;, but instead of direct text, it refers to another element that describes the component. It is useful if there is already an existing text that can be used. &lt;code&gt;aria-describedby&lt;/code&gt; is used to provide additional information about an element, often giving more context or explanation.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Contact Us&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"heading"&lt;/span&gt; &lt;span class="na"&gt;aria-describedby=&lt;/span&gt;&lt;span class="s"&gt;"form-info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Open Form&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"form-info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This form allows you to get in touch with our team.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. aria-hidden
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;aria-hidden&lt;/code&gt; is used to mark elements that should be ignored by screen readers. This attribute can be used to hide elements that are not important for users.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;aria-hidden=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;🔔&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt; Notification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. aria-expanded
&lt;/h3&gt;

&lt;p&gt;This attribute indicates whether an element (like a dropdown menu or accordion) is open or closed. It improves the user experience by providing information about the component's state.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-expanded=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt; &lt;span class="na"&gt;aria-controls=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Open Menu&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt; &lt;span class="na"&gt;hidden&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Menu Content&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. role
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;role&lt;/code&gt; defines what type of interactive element it is. Remember, &lt;code&gt;role&lt;/code&gt; should not be used on semantic elements like &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, and others because they already have their natural roles.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;role="complementary":&lt;/code&gt; Used to define content that complements the main content but is still meaningful on its own, like a sidebar.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;aside&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"complementary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Related Articles&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;role="presentation":&lt;/code&gt; Used for elements that should be ignored by assistive technologies because they are purely decorative.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"presentation"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- purely decorative table --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;aria-live:&lt;/code&gt; This attribute is used to notify screen readers about content that changes dynamically. It can have values like &lt;code&gt;polite&lt;/code&gt;, &lt;code&gt;assertive&lt;/code&gt;, or &lt;code&gt;off&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;aria-live=&lt;/span&gt;&lt;span class="s"&gt;"polite"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;New message received.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Good Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"dialog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is a dialog box&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bad Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click Here&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- Unnecessary, button already has a role --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion: Use ARIA Only When Necessary
&lt;/h2&gt;

&lt;p&gt;ARIA attributes are helpful tools to improve web accessibility. But remember, less is often more. ARIA should be used only when HTML cannot solve the problem naturally. Using ARIA correctly can greatly improve the experience for users who rely on assistive technologies.&lt;/p&gt;

&lt;p&gt;If you have any questions about ARIA attributes or how to use them on specific elements, feel free to ask! 😊&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>html</category>
      <category>aria</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why I Built the "Soo Good" Vegan Burger Website 🌱</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 06 Nov 2024 15:50:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/why-i-built-the-soo-good-vegan-burger-website-4d6e</link>
      <guid>https://forem.com/tomasdevs/why-i-built-the-soo-good-vegan-burger-website-4d6e</guid>
      <description>&lt;p&gt;I wanted to create a fun and interactive website for a vegan burger brand. The idea came from a design I found on Behance called "Vegan Food Restaurant Website UI Design." I took inspiration from it and added some of my own custom features to make it unique. 🍔&lt;/p&gt;

&lt;h2&gt;
  
  
  Features of the Website:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image Carousel 🖼️:&lt;/strong&gt; Users can see different vegan burger options in a smooth slider, thanks to Swiper.js.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modal Popups 🔔:&lt;/strong&gt; Clicking "Visit now" or "Order now" opens a modal window with more details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Buttons and Counters 🔢:&lt;/strong&gt; JavaScript powers dynamic text updates and a counter that shows the number of burgers ordered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responsive Design 📱💻:&lt;/strong&gt; The site looks great on both mobile and desktop devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technologies Used 💻:
&lt;/h2&gt;

&lt;p&gt;I used a simple tech stack for this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTML and CSS 📝:&lt;/strong&gt; For the structure and style.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bootstrap 🛠️:&lt;/strong&gt; To make development faster and easier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript ✨:&lt;/strong&gt; For interactive features and dynamic elements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SVG Icons 🖌️:&lt;/strong&gt; For social media and branding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swiper.js 🔄:&lt;/strong&gt; To create the smooth carousel effect.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup 🛠️
&lt;/h2&gt;

&lt;p&gt;To run this project locally:&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone this repository:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/TomasDevs/soo-good-website
&lt;span class="nb"&gt;cd &lt;/span&gt;soo-good-website
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Open&lt;/strong&gt; &lt;code&gt;index.html&lt;/code&gt; in your browser to view the website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check It Out:
&lt;/h2&gt;

&lt;p&gt;If you want to see the code, visit my &lt;a href="https://github.com/TomasDevs/soo-good-website" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. You can also check out the live version here: &lt;a href="https://soogoodvegan.netlify.app/" rel="noopener noreferrer"&gt;Soo Good Website on Netlify&lt;/a&gt;. ✨&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
      <category>bootstrap</category>
    </item>
    <item>
      <title>⚡ React Pure Loading: Lightweight CSS Loaders for React</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 30 Oct 2024 16:00:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/react-pure-loading-lightweight-css-loaders-for-react-127a</link>
      <guid>https://forem.com/tomasdevs/react-pure-loading-lightweight-css-loaders-for-react-127a</guid>
      <description>&lt;p&gt;&lt;strong&gt;React Pure Loading&lt;/strong&gt; is a new npm package that offers a collection of lightweight and performance-focused loading animations built purely with CSS. Designed to be simple and customizable, this package is perfect for React developers who need smooth, minimal loaders without the extra JavaScript overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why React Pure Loading?
&lt;/h2&gt;

&lt;p&gt;In modern web development, loading animations are essential for improving user experience. With &lt;strong&gt;React Pure Loading&lt;/strong&gt;, you get several types of loaders (such as dots, bounce, wave, ring, square, and more) that can easily integrate into your React projects. Since these loaders use pure CSS, they have a minimal impact on performance, which helps keep your applications fast.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation 📦
&lt;/h3&gt;

&lt;p&gt;You can install &lt;strong&gt;React Pure Loading&lt;/strong&gt; directly from npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;react-pure-loading
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage 🛠️
&lt;/h2&gt;

&lt;p&gt;To use the loaders, import the ones you need into your React component and include the CSS styles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Dots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Bounce&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Wave&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-pure-loading&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-pure-loading/dist/style.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Dots&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;medium&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#474bff&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Bounce&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;large&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#00ff00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Wave&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#ff6347&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customization 🎨
&lt;/h2&gt;

&lt;p&gt;Each loader supports these props:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;size: Options are &lt;code&gt;small&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, or &lt;code&gt;large&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;color: Any color in HEX or RGB format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Wave&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;large&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Try It Out 🚀
&lt;/h2&gt;

&lt;p&gt;Whether you’re building a new app or enhancing an existing project, give React Pure Loading a try. It’s a fast, lightweight, and easy-to-use library for creating visually appealing loaders with minimal impact on performance.&lt;/p&gt;

&lt;p&gt;Check out the full documentation and examples on &lt;a href="https://github.com/TomasDevs/react-pure-loading" rel="noopener noreferrer"&gt;GitHub &lt;/a&gt;or visit the package on &lt;a href="https://www.npmjs.com/package/react-pure-loading" rel="noopener noreferrer"&gt;npm&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>npm</category>
      <category>css</category>
      <category>loaders</category>
    </item>
    <item>
      <title>🚀 Creating a Developer's Portfolio Inspired by VS Code</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 23 Oct 2024 15:10:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/creating-a-developers-portfolio-inspired-by-vs-code-3ng2</link>
      <guid>https://forem.com/tomasdevs/creating-a-developers-portfolio-inspired-by-vs-code-3ng2</guid>
      <description>&lt;p&gt;Hey there, fellow developers! 👋 Today, I want to share with you my journey in building a personal portfolio that feels like home for any coder—because it’s designed like Visual Studio Code! If you love the look and feel of VS Code, you’ll enjoy exploring this project. 💻&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ What’s Inside:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A modern portfolio with a familiar look&lt;/li&gt;
&lt;li&gt;Built with React and a simple Express server 🧑‍💻&lt;/li&gt;
&lt;li&gt;Handling API requests to display dynamic content 🔄&lt;/li&gt;
&lt;li&gt;Deployed with Netlify and serverless functions ☁️&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. 💡 Why a VS Code-Inspired Portfolio?
&lt;/h2&gt;

&lt;p&gt;I wanted to create a portfolio that would not only show my skills and projects but would also be unique and fun to explore. Since I spend so much time coding in Visual Studio Code, I thought—why not make my portfolio look like it? This project combines the technical skills of a developer with a design that every coder can relate to.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🖥️ &lt;strong&gt;VS Code Feel:&lt;/strong&gt; A sidebar, tabs, and a title bar that make it feel like a real coding environment.&lt;/li&gt;
&lt;li&gt;🌗 &lt;strong&gt;Dark/Light Theme:&lt;/strong&gt; Switch between themes based on your preference.&lt;/li&gt;
&lt;li&gt;📝 &lt;strong&gt;Live Data:&lt;/strong&gt; Fetches my latest articles from dev.to and displays projects using custom APIs.&lt;/li&gt;
&lt;li&gt;🔐 &lt;strong&gt;Serverless Functions:&lt;/strong&gt; Securely handles API requests without exposing my API keys.&lt;/li&gt;
&lt;li&gt;📱 &lt;strong&gt;Responsive Design:&lt;/strong&gt; While it works on mobile, it’s best experienced on a desktop.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. ⚙️ How I Built It
&lt;/h2&gt;

&lt;p&gt;To get started, you’ll need Node.js and a Dev.to API key if you want to display your own articles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step-by-Step:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  📥 Clone the Project:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/tomasdevs/portfolio-vscode.git
&lt;span class="nb"&gt;cd &lt;/span&gt;portfolio-vscode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  📦 Install the Packages: Install everything you need for both the main app and the API:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install
cd &lt;/span&gt;api
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🔑 Set Up Environment Variables: Add your Dev.to API key in the .env file:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight make"&gt;&lt;code&gt;&lt;span class="nv"&gt;VITE_DEV_TO_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_api_key_here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🚀 Start the App: Run the server for API requests and start the Vite development server:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;api
node server.js
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🌐 View it on Your Browser:
&lt;/h4&gt;

&lt;p&gt;Go to &lt;a href="http://localhost:5173" rel="noopener noreferrer"&gt;http://localhost:5173&lt;/a&gt; to see the portfolio in action!&lt;/p&gt;

&lt;h2&gt;
  
  
  3. 🔄 Handling API Requests and Data
&lt;/h2&gt;

&lt;p&gt;One of the tricky parts was securely fetching data from my Dev.to profile without exposing the API key. I used Express and a serverless function on Netlify to create a simple backend for handling requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://dev.to/api/articles/me/published&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;api-key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VITE_DEV_TO_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, I can safely display my latest articles on the live site without worrying about security.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. 📚 What I Learned Along the Way
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🔒 Learning to Think About Security:&lt;/strong&gt; Making sure my API keys are secure was a big part of this project. I learned how to use environment variables, Express, and serverless functions to protect sensitive data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎨 Designing for Developers:&lt;/strong&gt; It was a fun challenge to make a portfolio that is both functional and appealing to other developers. It’s not every day you see a portfolio that looks like an IDE!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Deploying with Netlify:&lt;/strong&gt; Netlify made it easy to deploy my project with built-in serverless functions. It was my first time using this feature, and I was impressed by how smoothly it worked.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. 🌍 Check It Out!
&lt;/h2&gt;

&lt;p&gt;I’m excited to share this project with you all, and I hope it inspires other developers to think outside the box when creating their own portfolios. If you love coding and want a portfolio that feels like coding, give it a try! 🚀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tomasdevs.netlify.app/" rel="noopener noreferrer"&gt;Live Portfolio Demo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>portfolio</category>
    </item>
    <item>
      <title>🌐 CSS Units: When and How to Use Them</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 16 Oct 2024 15:20:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/css-units-when-and-how-to-use-them-3nj7</link>
      <guid>https://forem.com/tomasdevs/css-units-when-and-how-to-use-them-3nj7</guid>
      <description>&lt;p&gt;In CSS, there are many units to choose from when defining sizes and spacing, such as &lt;strong&gt;px&lt;/strong&gt;, &lt;strong&gt;rem&lt;/strong&gt;, &lt;strong&gt;em&lt;/strong&gt;, &lt;strong&gt;vw&lt;/strong&gt;, and others. Each unit has its strengths, so knowing when to use them is important. This guide will help you understand the most common CSS units and when to use them.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔒 Absolute Units
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📏 px (pixels)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; Fixed units that represent one pixel on the screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use px when you need precise control, like for &lt;strong&gt;border-radius&lt;/strong&gt; or &lt;strong&gt;box-shadow&lt;/strong&gt;. It's good when you need small, exact values that won’t change based on screen size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔄 Relative Units
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📐 rem (root em)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; Relative to the font-size of the root element (html).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use rem for &lt;strong&gt;font sizes&lt;/strong&gt;, &lt;strong&gt;padding&lt;/strong&gt;, and &lt;strong&gt;margins&lt;/strong&gt; in layout. It ensures your layout scales consistently across different devices, based on the root font-size (typically 16px).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Equals 32px if the root font-size is 16px */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📏 em
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; Relative to the font-size of the parent element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use em when you want an element’s size to depend on its parent. It's commonly used for &lt;strong&gt;padding&lt;/strong&gt; and &lt;strong&gt;margins&lt;/strong&gt; in components where the text size might vary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5em&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Padding is relative to the button's font size */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📱 vw (viewport width)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; 1% of the viewport’s width.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use vw for responsive layouts that scale with the width of the browser window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.full-width&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vw&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Full width of the viewport */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📐 vh (viewport height)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; 1% of the viewport’s height.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use vh to set elements that should be sized relative to the height of the screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.hero-section&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Full viewport height */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  💯 % (percentage)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; Percentage of the parent element’s size.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use % for layouts that need to adapt based on the size of the parent container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Takes up 80% of the parent element's width */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔍 Less Common Units
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔠 ch (character units)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; Based on the width of the "0" character in the font.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use ch for inputs or text areas where you want to control the number of characters visible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20ch&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Allows 20 characters to fit */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔧 clamp()
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; A function that allows you to set a size between a minimum, preferred value, and maximum.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; Use clamp() to create flexible sizes that adapt as the screen size changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1.5rem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;2vw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;3rem&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c"&gt;/* Responsive font size */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  📦 Example: Styling a Card with rem and em
&lt;/h2&gt;

&lt;p&gt;When building a card component, it's good practice to use &lt;strong&gt;rem&lt;/strong&gt; for layout and &lt;strong&gt;em&lt;/strong&gt; for text or padding that should adjust based on the font size.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Card layout with rem for consistent spacing */&lt;/span&gt;
&lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Consistent padding across the site */&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Space between cards */&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Rounded corners */&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c"&gt;/* Slight shadow */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Card title with rem for consistent font size */&lt;/span&gt;
&lt;span class="nc"&gt;.card-title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Font size relative to root font-size */&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Margin based on the title size */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Card content with rem for consistent text size */&lt;/span&gt;
&lt;span class="nc"&gt;.card-content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Consistent font size across the site */&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Button inside the card using em for padding */&lt;/span&gt;
&lt;span class="nc"&gt;.card-link&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5em&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Padding based on the button's font size */&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Font size relative to the button's text */&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#007bff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.3rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.card-link&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0056b3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTML Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Card Title&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is some content inside the card. The size is based on rem for consistency across the site.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Learn More&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  💡 Practical Tips:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use rem&lt;/strong&gt; for layout-related spacing, font sizes, and padding across your site. It helps keep everything consistent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use em&lt;/strong&gt; for text-specific components like buttons or internal padding, so they scale with the text size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use px&lt;/strong&gt; for small, exact values like border-radius or box-shadow, where precision is important.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎯 Conclusion
&lt;/h2&gt;

&lt;p&gt;Each CSS unit has its best use case. For a flexible and scalable design, use &lt;strong&gt;rem&lt;/strong&gt; for most of your layout and text sizing, &lt;strong&gt;em&lt;/strong&gt; for element-specific styles that need to adjust based on their context, and &lt;strong&gt;px&lt;/strong&gt; for precise details like borders. By mixing these units correctly, you can ensure that your design is responsive and user-friendly.&lt;/p&gt;

</description>
      <category>css</category>
      <category>productivity</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Understanding HTTP, HTTPS, and Status Codes: A Simple Guide</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 09 Oct 2024 15:30:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/understanding-http-https-and-status-codes-a-simple-guide-479b</link>
      <guid>https://forem.com/tomasdevs/understanding-http-https-and-status-codes-a-simple-guide-479b</guid>
      <description>&lt;p&gt;When you're building websites or web applications, you often hear about &lt;strong&gt;HTTP&lt;/strong&gt; and &lt;strong&gt;HTTPS&lt;/strong&gt;. But what do they really mean? And what about those status codes like &lt;strong&gt;404&lt;/strong&gt; or &lt;strong&gt;500&lt;/strong&gt;? In this article, we'll break down these concepts and explain them in a clear and easy-to-understand way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is HTTP? 🌐
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;HTTP&lt;/strong&gt; stands for &lt;strong&gt;Hypertext Transfer Protocol&lt;/strong&gt;. It’s the foundation of any data exchange on the web. When you visit a website, your browser sends an HTTP request to the web server, and the server responds with the requested data (usually in the form of a web page).&lt;br&gt;
Here’s a simple breakdown of how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You enter a URL into your browser (like &lt;a href="http://example.com" rel="noopener noreferrer"&gt;http://example.com&lt;/a&gt;). 📲&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The browser sends an HTTP request to the server where the website is hosted. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The server processes the request and sends back the data, which is then displayed in your browser.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;HTTP is &lt;strong&gt;not secure&lt;/strong&gt; by default, which means the data sent between the browser and server is not encrypted. This can be a risk when sensitive information (like passwords or credit card details) is involved.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Is HTTPS? 🔒
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;HTTPS&lt;/strong&gt; is the secure version of HTTP. The &lt;strong&gt;S&lt;/strong&gt; stands for &lt;strong&gt;Secure&lt;/strong&gt;. When you see &lt;em&gt;https://&lt;/em&gt; in the address bar, it means the website is using SSL/TLS encryption to protect the data that’s being transferred.&lt;br&gt;
Here’s how HTTPS is different from HTTP:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Encryption:&lt;/strong&gt; HTTPS encrypts the data between the browser and the server, so no one can see or steal it. 🔐&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Authentication:&lt;/strong&gt; HTTPS ensures that you're communicating with the intended website (not a fake or malicious one). ✅&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Data Integrity:&lt;/strong&gt; HTTPS guarantees that the data hasn’t been modified during transfer. 🛡️&lt;/p&gt;

&lt;p&gt;If you're building a website, it's important to use HTTPS, especially if your site handles sensitive data. Many browsers will now show a warning if a website doesn't use HTTPS, which can scare users away.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Are HTTP Status Codes? 📝
&lt;/h2&gt;

&lt;p&gt;When your browser makes a request to the server, the server responds with more than just the requested data. It also sends an &lt;strong&gt;HTTP status code&lt;/strong&gt; to tell your browser how things went.&lt;/p&gt;
&lt;h3&gt;
  
  
  Common Status Codes
&lt;/h3&gt;

&lt;p&gt;Here are some of the most common HTTP status codes you’ll encounter:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 200 OK:&lt;/strong&gt; Everything is working as expected. The server successfully returned the requested data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 201 Created:&lt;/strong&gt; The request was successful, and as a result, a new resource was created (e.g., after a POST request that adds data to the server).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 202 Accepted:&lt;/strong&gt; The request has been accepted for processing, but the processing is not yet complete. It’s often used for asynchronous tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 203 Non-Authoritative Information:&lt;/strong&gt; The server successfully processed the request, but the returned information comes from a third party, not the original source.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 204 No Content:&lt;/strong&gt; The server successfully processed the request, but there’s no content to return (e.g., after a DELETE request).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 301 Moved Permanently:&lt;/strong&gt; The requested resource has been permanently moved to a new URL. The browser should automatically redirect to the new location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 302 Found:&lt;/strong&gt; Similar to 301, but the move is temporary. The browser should redirect, but the resource may move back to the original URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 400 Bad Request:&lt;/strong&gt; The server couldn't understand the request due to invalid syntax, often caused by a client-side error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 401 Unauthorized:&lt;/strong&gt; The request requires user authentication. This often happens when a user tries to access a resource without being logged in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 403 Forbidden:&lt;/strong&gt; The server understands the request but refuses to authorize it. The user does not have the right permissions to access the resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 404 Not Found:&lt;/strong&gt; The server couldn’t find the resource or page that was requested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 500 Internal Server Error:&lt;/strong&gt; The server encountered an unexpected condition that prevented it from fulfilling the request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 502 Bad Gateway:&lt;/strong&gt; The server, while acting as a gateway or proxy, received an invalid response from the upstream server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- 504 Gateway Timeout:&lt;/strong&gt; The server, acting as a gateway or proxy, didn’t receive a timely response from the upstream server.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example of an HTTP Request and Response
&lt;/h3&gt;

&lt;p&gt;Here’s a simple example to show what an HTTP request and response might look like:&lt;/p&gt;
&lt;h4&gt;
  
  
  HTTP Request (from the browser to the server):
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/index.html&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;www.example.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  HTTP Response (from the server back to the browser):
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;text/html&lt;/span&gt;

&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Example Page&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to the Example Page!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this case, the server responded with a &lt;strong&gt;200 OK&lt;/strong&gt; status code, meaning the page loaded successfully.&lt;/p&gt;
&lt;h4&gt;
  
  
  Example of a 404 Error
&lt;/h4&gt;

&lt;p&gt;If the requested page isn't found, here’s what the response might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;404&lt;/span&gt; &lt;span class="ne"&gt;Not Found&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;text/html&lt;/span&gt;

&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Page Not Found&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;404 Error: Page Not Found&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;404 Not Found&lt;/strong&gt; status code tells the browser that the server couldn’t find the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do These Status Codes Matter? 🧐
&lt;/h2&gt;

&lt;p&gt;Understanding HTTP status codes is important for developers because they help you diagnose problems with your website or app. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If users are reporting broken links, you can check for &lt;strong&gt;404 errors&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If the website is experiencing downtime, you might see &lt;strong&gt;500 errors&lt;/strong&gt; in the logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By understanding these codes, you can quickly identify and fix issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion 💡
&lt;/h2&gt;

&lt;p&gt;HTTP and HTTPS are the backbone of how websites communicate with browsers, and HTTP status codes help developers understand what's going on behind the scenes. Whether you're fixing broken links or ensuring your site is secure, knowing how HTTP works is essential for any web developer.&lt;/p&gt;

</description>
      <category>http</category>
      <category>statuscodes</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🚀 Master Core Web Vitals: 3 Metrics for a Better User Experience</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 02 Oct 2024 15:40:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/master-core-web-vitals-3-metrics-for-a-better-user-experience-59gn</link>
      <guid>https://forem.com/tomasdevs/master-core-web-vitals-3-metrics-for-a-better-user-experience-59gn</guid>
      <description>&lt;p&gt;Core Web Vitals are important metrics from Google that measure the performance of websites from the user's point of view. If you are building websites or web apps, you should pay attention to these three key metrics:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Largest Contentful Paint (LCP)&lt;/strong&gt; – This measures how long it takes for the largest element on the page, such as an image or text block, to load. A good LCP should be under 2.5 seconds. If it takes too long, users may lose patience and leave. To learn more about optimizing images for faster loading, check out &lt;a href="https://dev.to/tomasdevs/overview-of-image-formats-for-todays-websites-45a5"&gt;my article on image formats&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Interaction to Next Paint (INP)&lt;/strong&gt; – This metric measures how quickly a page responds to user interactions, like clicking a button or typing in a form. INP is better than the old metric, First Input Delay (FID), because it looks at all interactions, not just the first one. INP became a Core Web Vital in 2024, replacing FID to give developers a more complete view of how responsive their site is. A good INP should be under 200 milliseconds. Slow responses can frustrate users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Cumulative Layout Shift (CLS)&lt;/strong&gt; – This tracks how stable the layout of the page is while loading. If things move around on the page unexpectedly, it can be annoying for users. CLS should be under 0.1.&lt;/p&gt;

&lt;h2&gt;
  
  
  📈 Why Is This Important?
&lt;/h2&gt;

&lt;p&gt;Google uses these metrics as part of its ranking system. This means that if your website meets the Core Web Vitals standards, it can rank higher in search results. Also, faster and more stable websites offer a better user experience, which makes visitors more likely to return.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ How Can You Improve Core Web Vitals?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Optimize Images&lt;/strong&gt; – Make sure images are compressed and properly optimized for faster loading times. Read more in &lt;a href="https://dev.to/tomasdevs/overview-of-image-formats-for-todays-websites-45a5"&gt;my article on image formats for websites&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Reduce JavaScript Load Time&lt;/strong&gt; – Heavy or slow JavaScript can delay responses to user actions. For general performance tips, see &lt;a href="https://dev.to/tomasdevs/quick-tips-for-frontend-performance-optimization-27m1"&gt;my article on frontend performance optimization&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Use Caching&lt;/strong&gt; – Storing parts of your website in the browser’s cache can make it load faster when users visit again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Use Modern Technologies&lt;/strong&gt; – For example, use lazy loading for images and videos, so they load only when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Best Tools to Measure Core Web Vitals
&lt;/h2&gt;

&lt;p&gt;Here are some popular tools you can use to measure and monitor Core Web Vitals:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Google PageSpeed Insights&lt;/strong&gt; – This tool provides detailed Core Web Vitals scores for any URL. It also gives suggestions on how to improve performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Lighthouse&lt;/strong&gt; – Integrated into Chrome DevTools, Lighthouse provides in-depth reports on a site’s performance, including Core Web Vitals. It’s great for testing during development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Web Vitals Extension&lt;/strong&gt; – A Chrome extension that gives real-time feedback on Core Web Vitals while you browse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Google Search Console&lt;/strong&gt; – This tool lets you monitor Core Web Vitals for your entire site and see how individual pages perform over time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Chrome DevTools Performance Panel&lt;/strong&gt; – This lets you dive deep into the details of how your site is performing, including visualizing LCP, INP, and CLS events.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Conclusion
&lt;/h2&gt;

&lt;p&gt;Core Web Vitals are not just technical details for developers – they affect real user experiences. It’s important to make sure your website not only looks good but also runs fast and stays stable. Optimizing for Core Web Vitals can improve both your website's performance and its ranking in search engines. With the right tools, you can easily track and improve these key metrics to deliver a better user experience.&lt;/p&gt;

</description>
      <category>corewebvitals</category>
      <category>performance</category>
      <category>webperf</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Make Your CSS Better with SCSS Mixins and Functions</title>
      <dc:creator>Tomas Stveracek</dc:creator>
      <pubDate>Wed, 25 Sep 2024 15:50:00 +0000</pubDate>
      <link>https://forem.com/tomasdevs/make-your-css-better-with-scss-mixins-and-functions-133e</link>
      <guid>https://forem.com/tomasdevs/make-your-css-better-with-scss-mixins-and-functions-133e</guid>
      <description>&lt;p&gt;SCSS is an extension of CSS that makes your code easier to manage. With SCSS, you can use mixins and functions to help you avoid writing the same code again and again. In this article, I’ll show you some useful SCSS mixins and functions that can save you time and make your code cleaner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use Mixins and Functions?&lt;/strong&gt; When writing CSS, you often repeat the same styles. SCSS mixins and functions help by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoiding Repetition: Write common styles once and use them everywhere.&lt;/li&gt;
&lt;li&gt;Adding Flexibility: Change styles easily with parameters.&lt;/li&gt;
&lt;li&gt;Writing Dynamic Styles: Use calculations to create more flexible designs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Responsive Breakpoints Mixin
&lt;/h2&gt;

&lt;p&gt;When making websites responsive, you need to write a lot of media queries. This mixin makes it easy to handle breakpoints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$breakpoint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@if&lt;/span&gt; &lt;span class="nv"&gt;$breakpoint&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;mobile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;@content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;$breakpoint&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;tablet&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;900px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;@content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;$breakpoint&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;desktop&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;@content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mobile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;desktop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;40px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mixin lets you handle breakpoints by just using simple names like "mobile" or "desktop."&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Button Styles Mixin
&lt;/h2&gt;

&lt;p&gt;Creating buttons can be repetitive. This mixin lets you create buttons with different colors while keeping other styles the same.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$bg-color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$text-color&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$bg-color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$text-color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="mi"&gt;.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;darken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$bg-color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;10%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nc"&gt;.button-primary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;#007BFF&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.button-secondary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;#6C757D&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can create buttons quickly with just one line of code, adjusting the colors as needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Typography Mixin
&lt;/h2&gt;

&lt;p&gt;Typography is important for any website. This mixin lets you set up responsive typography with just a few lines of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;typography&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$font-size&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$line-height&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="mi"&gt;.5&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$weight&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;normal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$font-size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$line-height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$weight&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mobile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$font-size&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="mi"&gt;.9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;desktop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$font-size&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="mi"&gt;.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;typography&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;32px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="mi"&gt;.2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;typography&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mixin helps you make sure your font sizes look good on both small and large screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Function for Rem Units
&lt;/h2&gt;

&lt;p&gt;This function converts px values to rem, making your code easier to scale for different devices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@function&lt;/span&gt; &lt;span class="nf"&gt;px-to-rem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$base-font-size&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="nv"&gt;$px&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nv"&gt;$base-font-size&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;px-to-rem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;32&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of manually converting pixels to rem units, you can use this function to do it automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Color Adjustment Function
&lt;/h2&gt;

&lt;p&gt;Need to change a color quickly? This function darkens or lightens a color based on your input.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@function&lt;/span&gt; &lt;span class="nf"&gt;adjust-color-brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@if&lt;/span&gt; &lt;span class="nv"&gt;$amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="nf"&gt;lighten&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$amount&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="nf"&gt;darken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$amount&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;adjust-color-brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;#007BFF&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-10%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Darker blue&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this function, you can easily create lighter or darker shades of a color, perfect for hover effects or themes.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Grid Layout Mixin
&lt;/h2&gt;

&lt;p&gt;Creating grid layouts is easy with this mixin. It lets you set the number of columns and the space between them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;grid-layout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$columns&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$gap&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="na"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$columns&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1fr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="na"&gt;grid-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$gap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nc"&gt;.grid&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;grid-layout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mixin simplifies the process of creating grid layouts by allowing you to customize the number of columns and gaps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Mixins and functions in SCSS help you write cleaner and more efficient CSS. With just a few lines of code, you can make your styles more flexible and easier to maintain. Whether you’re creating responsive designs, buttons, or dynamic layouts, SCSS mixins and functions can make your life as a developer easier. Give them a try in your next project!&lt;/p&gt;

</description>
      <category>css</category>
      <category>scss</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
