<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marat Badykov on Medium]]></title>
        <description><![CDATA[Stories by Marat Badykov on Medium]]></description>
        <link>https://medium.com/@marat_badykov?source=rss-8a5e1ede74cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P3aWu3HlkpHXhIQiCeLC4w.jpeg</url>
            <title>Stories by Marat Badykov on Medium</title>
            <link>https://medium.com/@marat_badykov?source=rss-8a5e1ede74cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:59:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marat_badykov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Laravel Secure Baseline: Catch Critical Security Issues Before Production]]></title>
            <link>https://medium.com/@marat_badykov/laravel-secure-baseline-catch-critical-security-issues-before-production-ead2fe50c44a?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ead2fe50c44a</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 00:00:05 GMT</pubDate>
            <atom:updated>2026-01-25T16:01:12.346Z</atom:updated>
            <content:encoded><![CDATA[<h3>Laravel applications fail in predictable ways — and most teams discover it too late.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AF43AiPebliyE-6cikV5gQ.jpeg" /></figure><p>Independent security reviews consistently show that <strong>the majority of Laravel applications ship with at least one critical misconfiguration</strong>: debug mode enabled, missing security headers, unsafe CORS rules, or weak session cookies. These issues rarely break functionality, which is why they often reach production unnoticed — until a penetration test, compliance audit, or real-world incident exposes them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDKLtQyIdAlSuMW4x_VOQg.jpeg" /></figure><p><a href="https://github.com/bigdevwhale/laravel-secure-baseline"><strong>Laravel Secure Baseline</strong></a> was built to close this gap.</p><h3>What Problem Does It Solve?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-N1FZj1ujwaBPGmACWKtrw.jpeg" /></figure><p>Laravel Secure Baseline is a <strong>zero-configuration security scanner</strong> designed specifically for Laravel applications. It automatically detects the most common and high-impact security mistakes <strong>before they reach production</strong>.</p><p>In real production projects, the tool typically:</p><ul><li>Detects <strong>5–10 critical or high-risk issues</strong></li><li>Completes a full scan in <strong>under 2 seconds</strong></li><li>Auto-fixes up to <strong>90% of common misconfigurations</strong></li></ul><p>This makes it suitable not only for audits, but also for <strong>daily development, CI/CD pipelines, and pull request validation</strong>.</p><h3>Key Capabilities</h3><h4>1. Run a single command and get a clear, actionable report:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GAB7vmDAQbuYb39LIbrxVA.jpeg" /></figure><p>The scanner checks:</p><ul><li>Environment safety (APP_DEBUG, APP_KEY, .env exposure)</li><li>Session security flags (secure, httpOnly, sameSite)</li><li>Security headers (HSTS, CSP, X-Frame-Options, and more)</li><li>CORS misconfigurations</li><li>HTTPS enforcement</li><li>Sensitive data leakage in logs</li></ul><p>Each finding includes <strong>impact explanation and a concrete fix</strong>.</p><h3>2. Auto-Fix for Common Vulnerabilities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8vBr44ktYFrfTrEavlbZWw.jpeg" /></figure><p>Instead of only reporting issues, Laravel Secure Baseline can <strong>fix them automatically</strong>:</p><p>It safely updates configuration files, registers middleware, and suggests environment changes — reducing manual effort and human error.</p><h3>3. Native GitHub Security Integration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yqDVFROlQ6g050zWlWTSA.jpeg" /></figure><p>Laravel Secure Baseline is one of the <strong>very few Laravel tools with native SARIF output</strong>, enabling direct integration with <strong>GitHub Code Scanning</strong>:</p><p>Results appear directly in:</p><ul><li>GitHub’s <strong>Security</strong> tab</li><li>Pull request annotations</li><li>Historical security tracking</li></ul><p>This allows security checks to become part of the standard review process, not an afterthought.</p><h3>4. CI/CD Ready by Design</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4A4LvxVeSoY-vBsPm_1WQ.jpeg" /></figure><p>The scanner provides <strong>deterministic exit codes</strong>:</p><p>This makes it trivial to block deployments on real risks while allowing non-blocking warnings in early stages.</p><h3>5. Zero Configuration, Laravel-Native</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gni-fwSPdASTlt4OduQNcQ.jpeg" /></figure><p>Unlike many security tools, Laravel Secure Baseline works <strong>out of the box</strong>. No complex rule definitions, no large config files, no external services required.</p><p>Install, run, and get value in minutes.</p><h3>Get Started Today</h3><p>If you maintain or deploy Laravel applications, this tool can immediately improve your security baseline with minimal effort.</p><p>👉 <strong>Explore the repository and try it on your project:</strong> <a href="https://github.com/bigdevwhale/laravel-secure-baseline">https://github.com/bigdevwhale/laravel-secure-baseline</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Ey_Mi4sCFDiS_FIlzYPtA.jpeg" /></figure><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2026/01/25/laravel-secure-baseline-post/"><em>http://it.badykov.com</em></a><em> on January 25, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ead2fe50c44a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Habit & Reward System That Actually Works — Download It Here]]></title>
            <link>https://medium.com/@marat_badykov/i-built-a-habit-reward-system-that-actually-works-download-it-here-c19a9811b986?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c19a9811b986</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[gamification]]></category>
            <category><![CDATA[habits]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 11:54:21 GMT</pubDate>
            <atom:updated>2025-07-21T11:54:21.536Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Habit &amp; Reward System That Actually Works — Download It Here</h3><p>What if building good habits felt like playing a game?<br>Over the past months, I’ve built a system that <em>gamifies self-discipline</em> — and it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GwT4li7yXs9nfIV2.png" /></figure><p>Inspired by RPG mechanics and grounded in daily self-work, my habit and reward tracker in Google Sheets has become the cornerstone of my routine. This post dives into how it works, why it helps, and how you can use it to build yours.</p><h3>Why I Needed a Reward System</h3><p>Like many of us, I’ve always juggled multiple self-improvement goals: fitness, deep work, creativity, and mindfulness. I was consistent, but it often felt like a grind. There was no immediate dopamine hit, no feedback loop. I wanted a system that would:</p><ul><li>Reward consistency</li><li>Make progress tangible</li><li>Let me enjoy life guilt-free (hello, beer 👀)</li><li>Turn self-discipline into a game</li></ul><p>So I built it.</p><h3>How It Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*an7Hx0kq3_pPMaxM.png" /></figure><p>The system is simple, but powerful:</p><ul><li>You earn points by completing key daily habits.</li><li>You can spend points on “rewards” (beer, Netflix, games, cheat meals, etc.).</li><li>There’s a <strong>weekly scoreboard</strong>, stats dashboard, and total balance.</li><li>It’s all powered by <strong>Google Sheets</strong>, so it’s easy to modify.</li></ul><p>Let me break it down.</p><h3>Daily Habits = Points</h3><p>Each habit I want to reinforce has a point value:</p><p>HabitPointsWorkout3Wim Hof Breathing2Study documentation2Code on my project3Learn music production2Write music3Duolingo1Listen to a new album1No food/sweets after 6 PM3Meditation &amp; affirmations2Pomodoro work blocks2</p><p>Every day, I mark ✅ or ❌ for each habit. The sheet adds up the points automatically.</p><h3>Rewards = Spendable Joy</h3><p>When I want to relax, I check how many points I have and “spend” them on a reward:</p><p>RewardCost (points)Watch a movie10One episode of a show61 hour of video games72 hours of games14A beer10Cheat meal15Music break (just listening)3Coffee outside4Offline walk (no phone)3Hot bath + music10Ordering food18Half-day off18Social meetup12Buy something small20Hobby upgrade25Major reward (gadget, etc.)50–100</p><p>No guilt. If I’ve earned it, I’ve earned it.</p><h3>The Weekly Dashboard</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/0*PsKD4tjqfXol_LDu.png" /></figure><p>This is where it gets interesting:</p><ul><li>I see how many points I earned each week</li><li>The average points per day</li><li>What I spent</li><li>What I saved</li></ul><p>This visibility keeps me motivated and helps me spot trends. If I had a bad week, I know exactly why. If I did great — hell yeah, I’ll celebrate with a nice reward.</p><h3>Why It Works (for Me)</h3><ul><li><strong>It’s honest.</strong> I can’t lie to myself. Either I did the habit or I didn’t.</li><li><strong>It’s visual.</strong> I see results — both earned and spent.</li><li><strong>It’s balanced.</strong> I can reward myself <em>without sabotaging my goals</em>.</li><li><strong>It’s flexible.</strong> Want to tweak habit values? Add new rewards? Easy.</li><li><strong>It’s gamified.</strong> It feels like leveling up in real life.</li></ul><h3>Want to Try It?</h3><p>I’d love for more people to experiment with this idea.</p><p>💡 <a href="https://docs.google.com/spreadsheets/d/1zaSfL4eZLlWLyZxX_GSgkh2CbiqeN0VmNUP4h1RDL60/edit?usp=sharing">Here’s a version of the sheet you can copy</a></p><h3>Final Thoughts</h3><p>This isn’t a “system that will change your life.”<br>It’s a tool — a practical framework that helped <em>me</em> stay consistent, motivated, and balanced. It might help you too, especially if:</p><ul><li>You’re driven but burn out quickly</li><li>You struggle to reward yourself without guilt</li><li>You love structure but hate rigidity</li></ul><p>If you give it a try or want help setting it up — reach out. I’d love to hear how you’d make it your own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c19a9811b986" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Laravel Caching with Cachetastic!]]></title>
            <link>https://medium.com/@marat_badykov/supercharge-your-laravel-caching-with-cachetastic-ce9a279ce026?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce9a279ce026</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Sat, 28 Oct 2023 00:00:13 GMT</pubDate>
            <atom:updated>2023-10-28T21:24:35.805Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*LCDKApzNu0R6cK-k.png" /></figure><p>Are you tired of slow API responses and sluggish database queries in your Laravel application? Do you wish you could sprinkle some magic dust and make your application’s performance go <em>poof</em> lightning fast? Well, we’ve got a secret weapon for you, and it’s called <strong>Cachetastic</strong>.</p><h3>The Need for Speed</h3><p>As Laravel developers, we’ve all been there. You’ve built a fantastic application, but when it comes to those pesky external API calls or complex database queries, things can get a bit sluggish. Your users are tapping their fingers, and your server is working overtime.</p><p>Or sometimes, your code for caching can become so complex that it’s hard to maintain and difficult to read.</p><p>Cachetastic simplifies the process, letting you focus on building your application while it handles the heavy lifting of caching. It’s time to supercharge your caching game.</p><h3>Introducing Cachetastic</h3><p>Cachetastic is not just another caching package; it’s your secret weapon for optimizing caching in Laravel applications. It’s designed to make caching method results a breeze, and it’s your ticket to faster responses, reduced latency, and happier users.</p><h3>What Makes Cachetastic Awesome?</h3><p>Cachetastic doesn’t just sprinkle some caching magic; it packs a punch with a range of features that set it apart:</p><h4>Method-Level Cachin</h4><p>Cachetastic lets you cache the results of any method. Whether you’re dealing with external APIs, complex database queries, or computationally intensive tasks, Cachetastic has got you covered.</p><h4>Give Up Complex Cache Code</h4><p>Have you ever wrestled with complex cache generation code? The days of generating intricate cache keys are over! Cachetastic automatically generates cache keys based on the method name and parameters. Say goodbye to complex code and embrace simplicity.</p><h4>Flexible Cache Management</h4><p>Cachetastic puts you in control. You can force-refresh and update the cache with new values on-demand. When things change, simply clear the cache, and Cachetastic will handle the rest.</p><h4>Laravel Integration</h4><p>If you’re a Laravel developer, you’ll love this. Cachetastic seamlessly integrates with Laravel’s caching system. It feels like it’s part of the family.</p><h3>Getting Started</h3><ol><li>Install Cachetastic using Composer:</li></ol><pre>composer require bigdevwhale/cachetastic</pre><p>2. Configure the default <a href="https://laravel.com/docs/10.x/cache">cache driver</a> in your Laravel application.</p><p>3. Start caching method results with Cachetastic. You can cache regular methods, or take it up a notch and cache static methods!</p><pre> use Cachetastic\Cachetastic;<br> use YourApiService;<br>   <br> // Create an instance of Cachetastic to cache the result of a regular method<br> $cacheService = new Cachetastic(<br>     new YourApiService(), // The service or object to call the method on.<br>     &#39;fetchData&#39;,          // The name of the method to call on the service.<br>     [1, 2]               // An array of parameters to pass to the method.<br> );<br>   <br> // Customize the cache duration (optional)<br> $cacheService-&gt;setCacheDuration(60);<br>   <br> // Cache the result of your API call, whether it&#39;s a regular method<br> $result = $cacheService-&gt;retrieveOrCache();<br>   <br> // Create an instance of Cachetastic to cache the result of a static method<br> $cacheServiceStatic = new Cachetastic(<br>     YourApiService::class, // The class with the static method.<br>     &#39;fetchDataStatic&#39;,    // The name of the static method to call.<br>     [1, 2]                // An array of parameters to pass to the static method.<br> );<br>   <br> // Cache the result of your API call, whether it&#39;s a static method<br> $resultStatic = $cacheServiceStatic-&gt;retrieveOrCache();</pre><p>4. Customize caching, force clear the cache when needed, and enjoy the speed of Cachetastic!</p><h3>Overwriting Cache Keys</h3><p>One thing to keep in mind: if two methods are executed in the same class with only array parameters, they will overwrite each other’s cache value since only scalar parameters are used for cache key generation. In this case, consider using the setCustomCacheKey method for fine-grained control.</p><h3>Join the Cachetastic Party</h3><p>Cachetastic is open-source software licensed under the MIT License. We also welcome contributions from the open-source community. Feel free to submit bug reports, feature requests, or pull requests on <a href="https://github.com/bigdevwhale/cachetastic">GitHub repository</a>.</p><p>So why wait? Supercharge your Laravel application with Cachetastic and turbocharge your caching game! Give it a try and experience the benefits for yourself. Happy caching! 💨✨</p><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2023/10/28/cachetastic/"><em>https://it.badykov.com</em></a><em> on October 28, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce9a279ce026" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify GoDaddy API Integration with This PHP Wrapper]]></title>
            <link>https://medium.com/@marat_badykov/simplify-godaddy-api-integration-with-this-php-wrapper-945b3a37f290?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/945b3a37f290</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[domain-registration]]></category>
            <category><![CDATA[godaddy]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Wed, 25 Oct 2023 00:00:13 GMT</pubDate>
            <atom:updated>2023-10-26T07:26:22.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5OTinfYqzyHqJbNa.jpg" /></figure><p>In the ever-evolving world of web development and domain management, a seamless integration with domain registrars like GoDaddy is essential. GoDaddy offers a powerful API that allows developers to interact with their system programmatically, providing a wide range of functionalities, from managing domains to handling accounts and performing domain-related tasks.</p><p>However, working directly with APIs can sometimes be challenging. To simplify the process, I’ve developed a PHP wrapper for the GoDaddy API. In this article, I’ll introduce you to this GoDaddy API PHP Wrapper, explain how to use it, and highlight its key features.</p><h3>Getting Started</h3><h4>Creating API Key</h4><p>Before diving into the wrapper, you’ll need to create API keys and secrets by following the instructions provided in the <a href="https://developer.godaddy.com/doc">GoDaddy API Documentation</a>. This step ensures you have the necessary credentials to access GoDaddy’s API.</p><h4>Installation</h4><p>GoDaddy API PHP Wrapper can be easily installed via Composer, a widely used PHP dependency manager. I’ve made the installation process simple and hassle-free. Just run the following command in your project directory:</p><pre><br>composer require your-namespace/godaddy-api-wrapper</pre><p>If you don’t have Composer installed, you can <a href="https://getcomposer.org/download/">download it here</a>.</p><h3>Using the Wrapper</h3><p>Once you’ve installed the wrapper, including it in your PHP script is straightforward. Simply add the following line to your script:</p><pre>require &#39;vendor/autoload.php&#39;;</pre><p>This line ensures the autoloading of necessary dependencies.</p><h3>Initialization</h3><p>To start using the wrapper, initialize it with your API key and secret for either the test or production environment. We offer an easy way to switch between environments by setting the isProduction flag.</p><pre>// Initialize the GoDaddyAPI with your API Key and Secret for the test environment<br>$apiKey = &#39;your-test-api-key&#39;;<br>$apiSecret = &#39;your-test-api-secret&#39;;<br><br>// Set the isProduction flag to false to use the test environment<br>$isProduction = false;<br><br>// Create an instance of GoDaddyAPI for the test environment<br>$goDaddyAPI = new \GoDaddyAPI\GoDaddyAPI($apiKey, $apiSecret, $isProduction);</pre><p>With this setup, you’re ready to make use of the wrapper for various GoDaddy API endpoints.</p><h3>Key Features</h3><p>GoDaddy API PHP Wrapper comes with a range of key features, making it a valuable tool for developers. Here are some of the highlights:</p><h4>Access to Various API Endpoints</h4><p>The wrapper provides access to different API endpoints such as Abuse, Aftermarket, Agreements, Certificates, Countries, Domains, Orders, Parking, Shoppers, and Subscriptions. These endpoints allow users to perform specific actions like domain registration, certificate management, and more.</p><p>Here’s an example of how to use the Domains endpoint to list all domains associated with your account:</p><pre>$domains = $goDaddyAPI-&gt;domains()-&gt;listDomains();<br>print_r($domains);</pre><h4>Configuration</h4><p>Wrapper allows users to configure the base URL for either the production or test environment. This flexibility is vital for users who need to switch between these environments seamlessly. You can easily switch between environments by changing the isProduction flag during initialization.</p><h3>Contributing</h3><p>In conclusion, the GoDaddy API PHP Wrapper simplifies working with the GoDaddy API, making domain management and integration into your web applications more straightforward. With this wrapper, developers can harness the power of GoDaddy’s API while benefiting from easy installation and clear documentation.</p><p>By offering a quick setup process and the ability to work in both production and test environments, GoDaddy API PHP Wrapper is a valuable tool for anyone looking to leverage the capabilities of GoDaddy’s domain management services.</p><h3>License</h3><p>GoDaddy API PHP Wrapper is open source and available for use in your projects. It is released under MIT. You can find the full details in the project’s GitHub <a href="https://github.com/bigdevwhale/godaddy-api-wrapper">repository</a>.</p><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2023/10/25/godaddy-api-wrapper/"><em>https://it.badykov.com</em></a><em> on October 25, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=945b3a37f290" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 Simple and Useful PostgreSQL Features that I wish I knew when I started]]></title>
            <link>https://medium.com/@marat_badykov/6-simple-and-useful-postgresql-features-that-i-wish-i-knew-when-i-started-3795b06906f4?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3795b06906f4</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-queries]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 15:01:57 GMT</pubDate>
            <atom:updated>2022-09-12T15:01:57.807Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*a2DJu3pa1jATqGArTDoCUw.png" /></figure><p>I use PostgreSql a lot in my working time. So recently, I spent some time refreshing and deepening my knowledge of PostgreSQL to improve my skills and experience in using it (writing and optimizing queries, creating new objects, etc.). And I found many awesome features and syntax sugar constructions that can tremendously ease your daily routine and eliminate problems that may appear while resolving sophisticated tasks. In this article, I will try to review 6 PostgreSql traits that seem to me the most important and easy-usable in a clear and brief way.</p><h3>Features</h3><ul><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#identity">Identity</a></li><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#coalesce--nullif">COALESCE + NULLIF</a></li><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#grouping-set-rollup-cube">Grouping set, rollup, cube</a></li><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#common-table-expression">Common Table Expression</a></li><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#domains">Domains</a></li><li><a href="https://it.badykov.com/blog/2022/09/12/simple-and-usefull-postgresql-features/#using-keyword">USING keyword</a></li></ul><h3>Identity</h3><p>Serial is the “old” implementation of auto-generated unique values that has been part of Postgres for ages. However that is not part of the SQL standard.</p><p>To be more compliant with the SQL standard, Postgres 10 introduced the syntax using generated as identity.</p><p>The underlying implementation is still based on a sequence, the definition now complies with the SQL standard. One thing that this new syntax allows is to prevent an accidental override of the value.</p><p>Consider the following tables:</p><pre><strong>create</strong> <strong>table</strong> t1 (id serial <strong>primary</strong> <strong>key</strong>);<br><strong>create</strong> <strong>table</strong> t2 (id integer <strong>primary</strong> <strong>key</strong> <strong>generated</strong> always <strong>as</strong> <strong>identity</strong>);</pre><p>Now when you run:</p><pre><strong>insert</strong> <strong>into</strong> t1 (id) <strong>values</strong> (1);</pre><p>The underlying sequence and the values in the table are not in sync any more. If you run another</p><pre><strong>insert</strong> <strong>into</strong> t1 default_values;</pre><p>You will get an error because the sequence was not advanced by the first insert, and now tries to insert the value 1 again.</p><p>With the second table however,</p><pre><strong>insert</strong> <strong>into</strong> t2 (id) <strong>values</strong> (1);</pre><p>Results in:</p><blockquote>ERROR: cannot insert into column “id” Detail: Column “id” is an identity column defined as GENERATED ALWAYS.</blockquote><p>So you can’t accidentally “forget” the sequence usage. You can still force this, using the override system value option:</p><pre><strong>insert</strong> <strong>into</strong> t2 (id) <strong>overriding</strong> <strong>system</strong> value <strong>values</strong> (1);</pre><p>which still leaves you with a sequence that is out-of-sync with the values in the table, but at least you were made aware of that.</p><p>identity columns also have another advantage: they also minimize the grants you need to give to a role in order to allow inserts.</p><p>While a table using a serial column requires the INSERT privilege on the table and the USAGE privilege on the underlying sequence this is not needed for tables using an identity columns. Granting the INSERT privilege is enough.</p><p>It is recommended to use the new identity syntax rather than serial.</p><p>For more information, you can refer to the official documentation</p><h3>COALESCE + NULLIF</h3><p>As everybody knows the COALESCE function accepts an unlimited number of arguments and returns the first argument that is not null. If all arguments are null, the COALESCE function will return null. Here is how it interprets multiple null values:</p><pre>postgres<strong>=#</strong> <strong>SELECT</strong> COALESCE(<strong>null</strong>,<strong>null</strong>, 1, 2, 3, <strong>null</strong>, 4);<br><br>  COALESCE <br>        1<br><br>(1 <strong>row</strong>)</pre><p>But what if you want similar to COALESCE function for zero instead of null. In that case you can combine NULLIF with COALESCE: The NULLIF function returns a null value if argument_1 equals to argument_2, otherwise it returns argument_1.</p><p>See the following example:</p><pre><strong>SELECT</strong><br>	<strong>NULLIF</strong> (1, 1); <strong>-</strong> <strong>return</strong> <strong>NULL</strong><br><strong>SELECT</strong><br>	<strong>NULLIF</strong> (1, 0); <strong>-</strong> <strong>return</strong> 1<br><strong>SELECT</strong><br>	<strong>NULLIF</strong> (&#39;A&#39;, &#39;B&#39;); <strong>-</strong> <strong>return</strong> A</pre><p>So in the example proposed above you to make COALESCE return first non-zero value, you can simply replace all COALESCE arguments with such call: NULLIF(arg, 0)</p><pre><strong>SELECT</strong> COALESCE(<strong>NULLIF</strong>(arg_1, 0), <strong>NULLIF</strong>(arg_2, 0), <strong>NULLIF</strong>(arg_3, 0))</pre><h3>Grouping set, rollup, cube</h3><p>grouping set, rollup, cube are irreplaceable tools for reporting and performance purposes.</p><h3>Grouping set</h3><p>GROUP BY will turn every distinct entry in a column into a group. Sometimes you might want to do more grouping at once. Why is that necessary? Suppose you are processing a 10 TB table. Clearly, reading this data is usually the limiting factor in terms of performance. So reading the data once and producing more results at once is appealing. That’s exactly what you can do with GROUP BY GROUP SETS. Suppose we want to produce two results at once:</p><ul><li>GROUP BY country</li><li>GROUP BY product_name</li></ul><p>Here’s how it works:</p><pre>test<strong>=#</strong> <strong>SELECT</strong>  country, product_name, <strong>sum</strong>(amount_sold)<br>       <strong>FROM</strong>    t_sales<br>       <strong>GROUP</strong> <strong>BY</strong> <strong>GROUPING</strong> <strong>SETS</strong> ((1), (2))<br>       <strong>ORDER</strong> <strong>BY</strong> 1, 2;<br> country   <strong>|</strong> product_name <strong>|</strong> <strong>sum</strong><br><em>-----------+--------------+-----</em><br> Argentina <strong>|</strong>              <strong>|</strong> 137<br> Germany   <strong>|</strong>              <strong>|</strong> 104<br> USA       <strong>|</strong>              <strong>|</strong> 373<br>           <strong>|</strong> Hats         <strong>|</strong> 323<br>           <strong>|</strong> Shoes        <strong>|</strong> 291<br>(5 <strong>rows</strong>)</pre><h3>Rollup</h3><p>When creating reports, you will often need the “bottom line” which sums up what has been shown in the table. The way to do that in SQL is to use “GROUP BY ROLLUP”:</p><pre>test<strong>=#</strong> <strong>SELECT</strong>  country, product_name, <strong>sum</strong>(amount_sold)<br>       <strong>FROM</strong>    t_sales<br>       <strong>GROUP</strong> <strong>BY</strong> <strong>ROLLUP</strong> (1, 2)<br>       <strong>ORDER</strong> <strong>BY</strong> 1, 2;<br> country   <strong>|</strong> product_name <strong>|</strong> <strong>sum</strong><br><em>-----------+--------------+-----</em><br> Argentina <strong>|</strong> Hats         <strong>|</strong> 111<br> Argentina <strong>|</strong> Shoes        <strong>|</strong>  26<br> Argentina <strong>|</strong>              <strong>|</strong> 137<br> Germany   <strong>|</strong> Hats         <strong>|</strong>  41<br> Germany   <strong>|</strong> Shoes        <strong>|</strong>  63<br> Germany   <strong>|</strong>              <strong>|</strong> 104<br> USA       <strong>|</strong> Hats         <strong>|</strong> 171<br> USA       <strong>|</strong> Shoes        <strong>|</strong> 202<br> USA       <strong>|</strong>              <strong>|</strong> 373<br>           <strong>|</strong>              <strong>|</strong> 614<br>(10 <strong>rows</strong>)</pre><p>PostgreSQL will inject a couple of rows into the result. As you can see, “Argentina” returns 3 and not just 2 rows. The “product_name = NULL” entry was added by ROLLUP. It contains the sum of all argentinian sales (116 + 27 = 137). Additional rows are injected for both other countries. Finally, a row is added for the overall sales worldwide.</p><h3>CUBE</h3><pre><strong>ROLLUP</strong> <strong>is</strong> useful if you want <strong>to</strong> <strong>add</strong> the “bottom line”. However, you often want <strong>to</strong> see <strong>all</strong> combinations <strong>of</strong> countries <strong>and</strong> products. <strong>GROUP</strong> <strong>BY</strong> <strong>CUBE</strong> will <strong>do</strong> exactly that:<br><br>test<strong>=#</strong> <strong>SELECT</strong>  country, product_name, <strong>sum</strong>(amount_sold)<br>       <strong>FROM</strong>    t_sales<br>       <strong>GROUP</strong> <strong>BY</strong> <strong>CUBE</strong> (1, 2)<br>       <strong>ORDER</strong> <strong>BY</strong> 1, 2;<br> country   <strong>|</strong> product_name <strong>|</strong> <strong>sum</strong><br><em>-----------+--------------+-----</em><br> Argentina <strong>|</strong> Hats         <strong>|</strong> 111<br> Argentina <strong>|</strong> Shoes        <strong>|</strong>  26<br> Argentina <strong>|</strong>              <strong>|</strong> 137<br> Germany   <strong>|</strong> Hats         <strong>|</strong>  41<br> Germany   <strong>|</strong> Shoes        <strong>|</strong>  63<br> Germany   <strong>|</strong>              <strong>|</strong> 104<br> USA       <strong>|</strong> Hats         <strong>|</strong> 171<br> USA       <strong>|</strong> Shoes        <strong>|</strong> 202<br> USA       <strong>|</strong>              <strong>|</strong> 373<br>           <strong>|</strong> Hats         <strong>|</strong> 323<br>           <strong>|</strong> Shoes        <strong>|</strong> 291<br>           <strong>|</strong>              <strong>|</strong> 614<br>(12 <strong>rows</strong>)</pre><p>In this case, we’ve got all the combinations. Technically, it’s the same as: GROUP BY country + GROUP BY product_name + GROUP BY country_product_name + GROUP BY (). We could do that using more than just one statement, but doing it at once is easier — and a lot more efficient.</p><p>Again, NULL values have been added to indicate various aggregation levels.</p><h3>Common Table Expression</h3><p>A common table expression is a temporary result set which you can reference within another SQL statement including SELECT, INSERT, UPDATE or DELETE.</p><p>Common Table Expressions are temporary in the sense that they only exist during the execution of the query.</p><p>The following shows the syntax of creating a CTE:</p><pre><strong>WITH</strong> cte_name (column_list) <strong>AS</strong> (     CTE_query_definition  ) <strong>statement</strong>;</pre><p>Common Table Expressions or CTEs are typically used to simplify complex joins and subqueries in PostgreSQL.</p><p>The following statement illustrates how to join a CTE with a table:</p><pre><strong>WITH</strong> cte_rental <strong>AS</strong> (<br>    <strong>SELECT</strong> staff_id,<br>        <strong>COUNT</strong>(rental_id) rental_count<br>    <strong>FROM</strong>   rental<br>    <strong>GROUP</strong>  <strong>BY</strong> staff_id<br>)<br><strong>SELECT</strong> s.staff_id,<br>    first_name,<br>    last_name,<br>    rental_count<br><strong>FROM</strong> staff s<br>    <strong>INNER</strong> <strong>JOIN</strong> cte_rental <strong>USING</strong> (staff_id);</pre><p>In this example:</p><p>First, the CTE returns a result set that includes staff id and the number of rentals. Then, join the staff table with the CTE using the staff_id column.</p><h3>Domains</h3><p>In my opinion, this is a very useful feature for creating a custom type if you have many columns that need to be restricted by several of the same constraints, have same data type and/or same default value. Let’s create, for example, a VARCHAR domain that should have a not null constraint and a default value of ‘N/A’.</p><pre><strong>CREATE</strong> <strong>DOMAIN</strong> addr VARCHAR(90) <strong>NOT</strong> <strong>NULL</strong> <strong>DEFAULT</strong> &#39;N/A&#39;;</pre><h3>USING keyword</h3><p>The USING clause is a shorthand that allows you to take advantage of the specific situation where both sides of the join use the same name for the joining column(s). It takes a comma-separated list of the shared column names and forms a join condition that includes an equality comparison for each one. For example, joining T1 and T2 with USING (a, b) produces the join condition ON T1.a = T2.a AND T1.b = T2.b.</p><h3>Conclusion</h3><p>This post covers simple and helpful features of Postgresql. For more info, you can always refer to official docs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3795b06906f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spotify Playlists To Help You Conquer The Work Day]]></title>
            <link>https://medium.com/@marat_badykov/spotify-playlists-to-help-you-conquer-the-work-day-208185f251c8?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/208185f251c8</guid>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[concentration]]></category>
            <category><![CDATA[music-playlist]]></category>
            <category><![CDATA[spotify-playlist]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Fri, 22 Jul 2022 09:21:24 GMT</pubDate>
            <atom:updated>2022-08-13T12:17:50.941Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WFvLUdmXO74AwXVdC5Vo1A.jpeg" /></figure><p>We all need some help occasionally to get through the hum-drum of a workday. Some days you can focus like a laser, and other days, you realize that your brain is out to lunch. We’ve all been there! Luckily, we have an easy solution that will help rope in your attention and give you that much-needed boost of motivation on those off days.</p><p>Specific genres of music are shown to increase focus, improve performance, and lower anxiety. There are thousands of playlists to discover that you can listen. If you’re looking for a starter’s guide, look no further. We have you covered!</p><p>The playlists we share are sure to get you in the zone and lift you out of your workday blues.</p><h3>Lofi hip hop</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msBVqfTA1_Cwrt4lE79wHw.jpeg" /></figure><p>This is music <em>designed</em> to be played in the background!<br>There are endless hours of lofi hip hop music available, and they all create a nice backdrop for getting real work done.</p><p>Playlists:</p><ul><li>Programming and Coding Lofi Hip-Hop: <a href="https://open.spotify.com/playlist/6ck3rYLGEOELZjQnUE0srv?si=81cdacbba47846ef">https://open.spotify.com/playlist/6ck3rYLGEOELZjQnUE0srv</a></li><li>Lofi / Chill Beats: <a href="https://open.spotify.com/playlist/7kLnZ4V1p0DSVhpn9BUkxI">https://open.spotify.com/playlist/7kLnZ4V1p0DSVhpn9BUkxI</a></li></ul><h3>Phonk &amp; Wave</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*MjHywnpPKnnzuDaMC5C-AA.jpeg" /></figure><p>For many it is associated with drifting or racing, there are a lot of videos on YouTube with such a video sequence against which phonk plays in the background.<br>It will sound strange because I don’t even have a car and I don’t know how to drive, but when I listen to these playlists at work, I imagine that I am racing and I need to drive as fast as possible, and thus the work can be done quickly enough.</p><p>Playlists:</p><ul><li>Phonk Racing Club 😈 Badass Drift Music: <a href="https://open.spotify.com/playlist/2hYwowANDNN6qiV5zAf0sV?si=ae31546d97e04a10">https://open.spotify.com/playlist/2hYwowANDNN6qiV5zAf0sV</a></li><li>Wave | Hardwave | Phonkwave:<br><a href="https://open.spotify.com/playlist/38afSowubzUmmwMEfAc74s?si=9c33c14cf0264f26">https://open.spotify.com/playlist/38afSowubzUmmwMEfAc74s</a></li></ul><h3>Synthwave / Retrowave</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9ihWVr-jwxoOvIKGG8PnQ.jpeg" /></figure><p>Synthwave (also called outrun, retrowave, or futuresynth) is an electronic music microgenre that is based predominantly on the music associated with action, science-fiction, and horror film soundtracks of the 1980s.</p><p>Playlists:</p><ul><li>Retrowave Synthwave: <br><a href="https://open.spotify.com/playlist/0dR9tMgRgjtEl6MYb7dr0D">https://open.spotify.com/playlist/0dR9tMgRgjtEl6MYb7dr0D</a></li><li>Synthwave — Night Drive:<br><a href="https://open.spotify.com/playlist/1XPmBcso1wopStan1xEUfg">https://open.spotify.com/playlist/1XPmBcso1wopStan1xEUfg</a></li></ul><h3>Conclusion</h3><p>Remember: there are no rules here! Whatever works for you, works for you; but hopefully this post has given you some new ideas about what to listen to the next time you need some background music.</p><p>Happy listening!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=208185f251c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modern JavaScript: ES6. Part 1. Short and clear.]]></title>
            <link>https://medium.com/@marat_badykov/modern-javascript-es6-part-1-short-and-clear-798f7615dddf?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/798f7615dddf</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[ecmascript-6]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Sat, 10 Oct 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-10-10T13:06:59.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*59sBt1CNYiBHos07S1qClQ.png" /></figure><p>ES6, also known as ECMAScript 2015, is a significant update to the language, and the first update to the language after ES5 was standardized in 2009.</p><p>In this series of posts, I will try to cover the main changes that have been introduced in ES6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*Bwxbv7Z8lQXyAdTsJ8n6wQ.png" /></figure><h3>Features</h3><ul><li>let and const</li><li>arrow functions</li><li>template literals</li><li>spread and rest operators</li><li>destructuring arrays and objects</li></ul><h3>let and const</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ToVIDSnziCw68-kpxNexgQ.png" /></figure><p><strong>let and const keywords</strong> allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which declares a variable globally, or locally to an entire function regardless of block scope.</p><p>The const declaration creates a read-only reference to a value so it can not be reassigned.</p><h3>Example</h3><pre><strong>for</strong> (<strong>let</strong> i<strong>=</strong>0; i <strong>&lt;</strong> array.length; i<strong>++</strong>) {<br>   <em>//some code</em><br>}<br><br>console.log(i) <em>// Uncaught ReferenceError: i is not defined because of let is block-scoped</em><br><br><br><strong>const</strong> variable <strong>=</strong> 5;<br>variable <strong>=</strong> 6; <em>// Uncaught TypeError: Assignment to constant variable</em></pre><h3>Browser compatibility</h3><h4>const</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*dhSFi09ezqnIi8sT3XI4qg.png" /></figure><h4>let</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*ALVLL9U_-5boBcxcF1AwpA.png" /></figure><h3>Arrow functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*wQ9_aeNVCTZ50MlefONjjQ.png" /></figure><p><strong>An arrow function</strong> expression is a compact alternative to a traditional function expression</p><h3>Differences &amp; Limitations:</h3><ul><li>Does not have its own bindings to this or super, and should not be used as methods.</li><li>Does not have arguments, or new.target keywords.</li><li>Not suitable for call, apply and bind methods, which generally rely on establishing a scope.</li><li>Can not be used as constructors.</li><li>Can not use yield, within its body.</li></ul><h3>Example</h3><pre><em>// Traditional Function</em><br><strong>function</strong> (a){<br>  <strong>return</strong> a <strong>+</strong> 100;<br>}<br><br><em>// Arrow Function </em><br>a <strong>=&gt;</strong> a <strong>+</strong> 100;</pre><h3>Browser compatibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*js8IzS2KkOD_pdpGM_IZFw.png" /></figure><h3>Template literals</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*A4pVeaCkQC2JG2SfSp8mPA.png" /></figure><p><strong>Template literals</strong> are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them.</p><h3>Example</h3><pre><em>// es5</em><br><strong>function</strong> sayBuy(name){<br>  <strong>return</strong> &quot;Buy, &quot; <strong>+</strong> name;<br>}<br><br><em>// es6 - template literals</em><br><strong>function</strong> sayBuy(name){<br>  <strong>return</strong> `Buy, ${name}`;<br>}</pre><h3>Browser compatibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*Fn25uS3kCy8V0TilPY019A.png" /></figure><h3>Spread and rest operators</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkobBMlN8xVswrMjOks0fg.png" /></figure><p><strong>Spread syntax</strong> (…) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.</p><h3>Example</h3><pre><strong>function</strong> sum(x, y, z) {<br>  <strong>return</strong> x <strong>+</strong> y <strong>+</strong> z;<br>}<br><br><strong>const</strong> numbers <strong>=</strong> [1, 2, 3];<br><br>console.log(sum(...numbers));</pre><p><strong>Rest syntax</strong> looks exactly like spread syntax. In a way, rest syntax is the opposite of spread syntax. Spread syntax “expands” an array into its elements, while rest syntax collects multiple elements and “condenses” them into a single element.</p><h3>Example</h3><pre><strong>function</strong> sum(x, y, ...z) {<br>  <strong>let</strong> sum <strong>=</strong>  x <strong>+</strong> y;<br>  z.forEach(value <strong>=&gt;</strong> (sum <strong>+=</strong> value);<br>  <strong>return</strong> value;<br>}<br><br><br>console.log(sum(1, 2, 3, 4, 5));</pre><h3>Browser compatibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*D1Dqwx6ruFqtmVZrqzgvFA.png" /></figure><h3>Destructuring arrays and objects</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-mNn0rVcSdzJ4FZq_Oj9w.jpeg" /></figure><p><strong>The destructuring assignment syntax</strong> is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.</p><h3>Browser compatibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*lyVywfr983PSL9YUVHPbrw.png" /></figure><h3>Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnV4Jis15c0Q_k6JDMvfBg.jpeg" /></figure><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2020/10/10/es6-part1/"><em>https://it.badykov.com</em></a><em> on October 10, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=798f7615dddf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 10 JetBrains IDE keyboard shortcuts]]></title>
            <link>https://medium.com/@marat_badykov/top-10-jetbrains-ide-keyboard-shortcuts-ed7d0785bee1?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed7d0785bee1</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[shortcuts]]></category>
            <category><![CDATA[ide]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Sun, 06 Sep 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-09-06T20:24:11.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JBoXXfJK-GatQ3EH.jpg" /></figure><p>Code editor keyboard shortcuts can save you a lot of time. They can replace several operations with just one.</p><p>So a programmer who actively uses keyboard shortcuts will surpass the speed of writing code for a programmer that does not use shortcuts if they are equal in level of knowledge. In this post, I’d like to share my top 10 favorite keyboard shortcuts from the JetBrains editors.</p><h3>Why JetBrains IDE?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*zXYfYhUt1hHEmYQnr0NZhQ.png" /></figure><p>I have tried many different editors during my work. Almost all of them performed the function of a code editor well, but during the development process, you need to not only write code, but, for example, upload your code to a remote test server, manage the state of the data in the database, and save changes with help of version control systems and much more. And therefore, in addition to editors, it was necessary to install many other applications. All this had to be done until I installed ide from JetBrains. It saved me the hassle of switching between applications frequently.</p><h3>Shortcut</h3><h3>1. Ctrl + W</h3><p>Ctrl + W — Select successively increasing code blocks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*l2P6m06FkMrLZOXzgwuNXA.gif" /></figure><p>This keyboard shortcut should be known to all developers. Thanks to it, you can forget about the existence of the mouse during programming.</p><h3>2. Ctrl + D</h3><p>Ctrl + D — Duplicate current line or selected block</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*oJeWaGHY-3Cyy0tl1H_ihQ.gif" /></figure><p>In some cases, this keyboard shortcut will replace the shortcut ctrl + c and ctrl + v. So in return for two operations, you get one. Profit!</p><h3>3. Shift + Enter</h3><p>Shift + Enter — Start a new line</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*lK7GF6dVYpds1AqXykKZgQ.gif" /></figure><p>With this keyboard shortcut, it is convenient to create an empty line without moving the caret.</p><h3>4. Ctrl + Shift + Backspace</h3><p>Ctrl + Shift + Backspace — Navigate to last edit location</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*xYMGqNkazYGS_S4cEmRk-w.gif" /></figure><p>This shortcut will help you return the caret to the last changed places in the code.</p><h3>5. Ctrl + F11 and Ctrl + #[0–9]</h3><p>If you want to return to someplace in your code later, you can mark any code line in your solution or library code with a bookmark.</p><p>Ctrl + F11 — Toggle bookmark</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*0QHpEaAwGAnG-SkTSuFiPA.gif" /></figure><p>Ctrl + #[0–9] Go to numbered bookmark</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*tNQdd9lamJXI9Qwmg3EB3g.gif" /></figure><h3>6. Ctrl + Y</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*L4M6bjHRrkxWtz0OeFFPOg.gif" /></figure><p>Ctrl + Y — Delete line at caret</p><h3>7. Ctrl + Tab</h3><p>Ctrl + Tab — Switch between tabs and tool window</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*dT8oS5x-y2JHrtLKDhtOWA.gif" /></figure><p>This shortcut will help you quickly navigate inside your project.</p><h3>8. Ctrl + Alt + T</h3><p>Ctrl + Tab — Surround with…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*AOAwvJVJDQ1eEKvqD6o8jg.gif" /></figure><p>I use this keyboard shortcut to wrap the code, for example, with tags in HTML.</p><h3>9. Ctrl + Alt + L</h3><p>Ctrl + Alt + L Reformat code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*eTYaViCogxzjmBfXleLKvA.gif" /></figure><p>This shortcut will format your code so that no one can find fault with your coding style.</p><h3>10. Ctrl + N</h3><p>Ctrl + N — Go to class</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*z3R48IVWAphcEP4pK_9Nog.gif" /></figure><p>Nothing more, just search by classes.</p><h3>Summary</h3><p>In this post, I talked about the top 10 Jetbrains ide shortcuts that I use every day.</p><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2020/09/06/top-shortcuts/"><em>https://it.badykov.com</em></a><em> on September 6, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed7d0785bee1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Precedence]]></title>
            <link>https://medium.com/@marat_badykov/css-precedence-5485dbb4135d?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5485dbb4135d</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-08-18T18:38:45.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VGWHBwI6BQta5TZG.png" /></figure><p>In a single HTML document possible that some CSS rules will conflict with one another. CSS uses a mechanism called the <strong>cascade</strong> to resolve any such conflicts.</p><p>Before describing how the cascade works, we need to consider two of its main components — <strong>specificity</strong> and <strong>inheritance</strong>.</p><h3>Specificity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxWVZsQsJamAOvBA4qB0ug.jpeg" /></figure><p>Specificity refers to the relative weights of various rules. It determines which styles apply to an element when more than one rule could apply. Table shows how much each part of a selector contributes to the total specificity of that selector.</p><p>Specificity values are cumulative; thus, a selector containing two attribute identifiers and a class identifier (e.g.,<strong>[name=”email”][type=”checkbox”].hello</strong>) has a specificity of <strong>0,0,3,0</strong>. Specificity values are sorted from right to left; thus, a selector containing 4 element identifiers ( <strong>0,0,0,4</strong>) has a lower specificity than a selector containing just a single class identifier ( <strong>0,0,1,0</strong>).</p><p>The !important directive gives a declaration more weight than nonimportant declarations. The declaration retains the specificity of its selectors and is used only in comparison with other important declarations</p><p>If you want to learn more about css selectors, you can read my <a href="https://it.badykov.com/blog/2020/08/08/css-selectors/">last article</a> about css selectors.</p><h3>Inheritance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*EC7wG_BuBTieBLwnYPK_3Q.jpeg" /></figure><p>When no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element. Only the root element of the document gets the initial value given in the property’s summary.</p><p>Examples of non-inherited properties are <strong>padding</strong>, <strong>border</strong>, <strong>margin</strong>, and <strong>background</strong>.</p><h3>The Cascade</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2IPz3yHcVJSlbhFKZhcnQ.jpeg" /></figure><p>The cascade is how CSS resolves conflicts between styles; in other words, it is the mechanism by which a user agent decides, for example, what color to make an element when two different rules apply to it and each one tries to set a different color. Here’s how the cascade works:</p><ol><li>Find all rules with a selector that matches a given element.</li><li>Sort all declarations applying to the given element by explicit weight. Those rules that are marked !important have a higher explicit weight than those that are not.</li><li>Sort all declarations applying to the given element by origin. There are three basic origins: author, reader, and user agent. Under normal circumstances, the author’s styles win out over the reader’s styles. Howerver, !important reader styles are stronger than any other styles, including !important author styles. Both author and reader styles override the user agent’s default styles.</li><li>Sort all declarations applying to the given element by specificity. Those elements with a higher specificity have more weight than those with lower specificity.</li><li>Sort all declarations applying to the given element by order. The later a declaration appears in the stylesheet or document, the more weight it is given. Declarations that appear in an imported stylesheet are considered to come before all declarations within the stylesheet that imports them.</li></ol><h3>See Also</h3><p><a href="https://medium.com/@marat_badykov/types-of-css-selectors-4f2b9eb9b5c0">Types of CSS Selectors</a></p><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2020/08/18/style-precedence/"><em>https://it.badykov.com</em></a><em> on August 18, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5485dbb4135d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of CSS Selectors]]></title>
            <link>https://medium.com/@marat_badykov/types-of-css-selectors-4f2b9eb9b5c0?source=rss-8a5e1ede74cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2b9eb9b5c0</guid>
            <category><![CDATA[css-selectors]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Marat Badykov]]></dc:creator>
            <pubDate>Fri, 07 Aug 2020 22:01:17 GMT</pubDate>
            <atom:updated>2020-08-07T22:03:41.720Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*jWiC7jxmiv2ddHC1.png" /></figure><p>CSS selector is the part of a CSS rule set that actually selects the content you want to style. Let’s look at all the different kinds of selectors</p><h3>Universal Selector</h3><p>Universal selector selects all the elements on a webpage.</p><h4>Example:</h4><pre><strong>*</strong> {<br>   margin: 0; <br>   padding: 0; <br>}</pre><h3>Element Selector</h3><p>Also referred to simply as a “type selector”, this selector must match one or more HTML elements of the same name.</p><h4>Example:</h4><pre>p {<br>   font-family: arial, helvetica, sans-serif; <br>}</pre><h3>Id Selector</h3><p>An ID selector is declared using a hash, or pound symbol (#) preceding a string of characters. The stringof characters is defined bythe developer. This selector matches any HTML element that has an ID attribute with the samevalue as thatof the selector, but minus the hash symbol.</p><h4>Example:</h4><pre><strong>#paragraph1</strong> {<br>    margin: 0; <br>}</pre><h3>Class Selector</h3><p>The class selector is the most useful of all CSS selectors. It’s declared with a dot preceding a string of one or more characters. Just as is the case with an ID selector, this string of characters is defined by the developer. The class selector also matches all elements on the page that have their class attribute set to the same value as the class, minus the dot.</p><h4>Example:</h4><pre><strong>.note</strong> {<br>   color: red; <br>   background-color: yellow; <br>   font-weight: bold; <br>}</pre><h3>Attribute Selector</h3><p>The attribute selector targets elements based on the presence and/or value of HTML attributes, and is declared using square brackets</p><h4>Example:</h4><pre>a<strong>[</strong>href<strong>=</strong>&quot;http://www.somesite.com&quot;<strong>]</strong> {<br>   font-weight: bold; <br>}</pre><h3>Descendant Combinator</h3><p>The class selector is the most useful of all CSS selectors. It’s declared with a dot preceding a string of one or more characters. Just as is the case with an ID selector, this string of characters is defined by the developer. The class selector also matches all elements on the page that have their class attribute set to the same value as the class, minus the dot.</p><h4>Example:</h4><pre>div<strong>#paragraph1</strong> p<strong>.note</strong> {<br>   color: green; <br>}</pre><h3>Child Combinator</h3><p>A selector that uses the child combinator is similar to a selector that uses a descendant combinator, except it only targets immediate child elements</p><h4>Example:</h4><pre>p<strong>.note</strong> <strong>&gt;</strong> b {<br>   color: blue; <br>}</pre><h3>General Sibling Combinator</h3><p>A selector that uses a general sibling combinator matches elements based on sibling relationships. That is to say, the selected elements are beside each other in the HTML.</p><h4>Example:</h4><pre>h2 <strong>~</strong> p {<br> margin-bottom: 20px;<br>}</pre><h3>Adjacent Sibling Combinator</h3><p>A selector that uses the adjacent sibling combinator uses the plus symbol (+), and is almost the same as the general sibling selector. The difference is that the targeted element must be an immediate sibling, not just a general sibling.</p><h4>Example:</h4><pre>p <strong>+</strong> p {<br> text-indent: 1.5em;<br> margin-bottom: 0;<br>}</pre><h3>Pseudo-class</h3><p>A pseudo-class uses a colon character to identify a pseudo-state that an element might be in-for example, the state of being hovered, or the state of being activated.</p><h4>Example:</h4><pre>a:active {<br>   color: blue;<br>}</pre><h3>Pseudo-element</h3><p>Finally, CSS has a selector referred to as a pseudo-element and, used appropriately, it can be very useful.</p><h4>Example:</h4><pre>p::first-letter {<br>   font-size: 32px;<br>}</pre><p><em>Originally published at </em><a href="https://it.badykov.com/blog/2020/08/08/css-selectors/"><em>https://it.badykov.com</em></a><em> on August 8, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2b9eb9b5c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>