<?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: Vijay Koushik, S. 👨🏽‍💻</title>
    <description>The latest articles on Forem by Vijay Koushik, S. 👨🏽‍💻 (@svijaykoushik).</description>
    <link>https://forem.com/svijaykoushik</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%2F45125%2Fa0d7d298-2f45-4dff-a395-be5a620eb794.jpg</url>
      <title>Forem: Vijay Koushik, S. 👨🏽‍💻</title>
      <link>https://forem.com/svijaykoushik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/svijaykoushik"/>
    <language>en</language>
    <item>
      <title>The Slow Decline of My English Skills</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Thu, 26 Dec 2024 09:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/the-slow-decline-of-my-english-skills-3g4i</link>
      <guid>https://forem.com/svijaykoushik/the-slow-decline-of-my-english-skills-3g4i</guid>
      <description>&lt;p&gt;As a non-native English speaker, my journey with the language has always been one of persistent improvement, a pursuit of mastery. But ever since the advent of ChatGPT, I’ve noticed something strange happening—I’ve become too reliant on it, and in the process, my own command of the language has slowly deteriorated. It's as if the digital assistant, in its quest to simplify my writing, unintentionally took away the very skills I worked so hard to build.&lt;/p&gt;

&lt;p&gt;When I first began learning English, it was a challenging yet rewarding endeavor. I wasn’t just interested in speaking the language; I wanted to think in it, dream in it, and most importantly, master its nuances. In those early days, I would jot down every unfamiliar word, carefully writing definitions and translations, making sure to study them consistently. Flashcards became my best friend, and I took pride in expanding my vocabulary. Each new word I learned felt like a small victory, bringing me closer to fluency—not just at a basic level, but deeply understanding its idiomatic expressions, cultural subtleties, and even its grammar rules. I spent hours reading diverse texts to immerse myself in grammar, not just focusing on syntax, but also on developing a natural feel for the rhythm of the language—when to pause, how to vary sentence structure, and how to create a flow that would make my writing engaging.&lt;/p&gt;

&lt;p&gt;Enter ChatGPT—an innovation that would change everything. I remember the first time I used it, skeptically typing a sentence riddled with errors. I didn’t expect much, just a quick fix. But when the response came back, not only had ChatGPT corrected my mistakes, it had rewritten the entire sentence in a way that sounded more polished and professional. It felt like magic. Gone were the days when I had to meticulously review grammar guides or check my work repeatedly. I was hooked.&lt;/p&gt;

&lt;p&gt;At first, it seemed like a blessing—no more worrying about whether my tenses were correct or if my sentence structure was awkward. With ChatGPT, all I had to do was type, and the model would quickly suggest edits, improving my writing instantly. As someone who had painstakingly studied English for years, this sudden shift felt like a revelation. I could focus on expressing my ideas without worrying about minor errors. But little did I know, this convenience would come at a cost.&lt;/p&gt;

&lt;p&gt;As I continued to rely on ChatGPT for quick fixes, my approach to language began to shift. Writing, once a challenging but rewarding exercise, started to feel too effortless. The need to recall new words, form sentences from scratch, and engage deeply with grammar faded into the background. I wasn’t writing as much on my own anymore; I would draft something and then hand it over to ChatGPT for refinement. With each correction, I became more detached from the process of crafting the language myself. This over-reliance made me outsource my English skills to a machine. My vocabulary stagnated; the thrill of discovering new words faded. The deeper connections I once had with grammar—the nuances of sentence structure and tone—became less important because ChatGPT was there to tidy it all up in an instant.&lt;/p&gt;

&lt;p&gt;Ironically, this very article you’re reading right now was written with the assistance of ChatGPT. It’s a clear example of how easy it is to slip into the comfort of relying on technology rather than honing one’s own skills. While tools like ChatGPT can be incredibly helpful—especially for language learners who might benefit from immediate feedback or when working to overcome language barriers—they also run the risk of creating dependency. The more I leaned on it, the less I trusted my own abilities.&lt;/p&gt;

&lt;p&gt;However, I'm actively working to reclaim my voice. I’ve realized that the only way to rebuild my skills is to re-engage with the language on a deeper level. I’ve set a clear plan in motion: no more mindlessly relying on ChatGPT for every draft. I’m challenging myself to write more from scratch, allowing my thoughts to flow naturally, and only using the tool for occasional assistance when absolutely necessary. I’m reading with greater intention, not just to study grammar and vocabulary, but to immerse myself in the language’s deeper aspects—its tone, style, and voice.&lt;/p&gt;

&lt;p&gt;Every day, I push myself to interact with English on a more conscious level. When I come across a word I don’t know, I write it down, look it up, and integrate it into my vocabulary. I read articles and books that stretch my comprehension, and I write in journals, crafting essays, and even attempting creative pieces. Each of these exercises helps me regain the fluidity I once had with the language. Though I still turn to ChatGPT for occasional grammar checks, it’s no longer the crutch it once was. Now, I see it as a reminder of the journey I’ve taken and a tool I can use sparingly.&lt;/p&gt;

&lt;p&gt;The process isn’t fast, and it’s not always easy. But I’m committed to rebuilding my relationship with English. With every word I engage with, every sentence I write from scratch, I feel my confidence growing. I’m learning to trust myself again, to find my voice without relying on instant fixes. The journey continues, and with it, my commitment to truly mastering the language—not just as a tool for communication, but as a space for expression and creativity.&lt;/p&gt;

&lt;p&gt;I have written this article with the intention of sharing my journey and the lessons I’ve learned. But as I reflect on my experience with language, I've realized that over-reliance on ChatGPT for writing could extend beyond language—it could affect my work, too. For example, I might lean on it to solve programming problems at work, which could hinder my growth as a developer. Relying too much on instant solutions could prevent me from truly mastering coding skills and problem-solving. It’s a reminder to stay mindful of how easy it is to become dependent on technology, not just in my passions, but in my professional life as well.&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>overrelianceontech</category>
      <category>writingskills</category>
    </item>
    <item>
      <title>Coding Beyond Limits: My Journey of Building a Web App with AI Creativity</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Tue, 08 Aug 2023 10:08:58 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/coding-beyond-limits-my-journey-of-building-a-web-app-with-ai-creativity-1b1p</link>
      <guid>https://forem.com/svijaykoushik/coding-beyond-limits-my-journey-of-building-a-web-app-with-ai-creativity-1b1p</guid>
      <description>&lt;h2&gt;
  
  
  Unleashing AI Creativity: Journey into Building a Web App with ChatGPT
&lt;/h2&gt;

&lt;p&gt;Hey everyone 👋! Today, I'm thrilled to take you on an extraordinary journey that fuses human creativity with the boundless potential of artificial intelligence. Buckle up as we dive into the exhilarating process of building a web app using ChatGPT, an AI language model that proves coding can be a collaborative adventure!&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting the Stage: The Quest Begins
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s4JvT64e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrbl815k2o8wx5k3shql.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s4JvT64e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrbl815k2o8wx5k3shql.gif" alt="Let's get started" width="480" height="480"&gt;&lt;/a&gt;source: giphy&lt;/p&gt;

&lt;p&gt;Our adventure commenced with a bold vision: crafting a web app through the guidance of ChatGPT. The twist? I led ChatGPT step by step, making each interaction a treasure trove of creativity and coding wisdom. Choosing Vanilla JavaScript and HTML as the core, I aimed to keep the project simple and ChatGPT-friendly. Little did I know that the ensuing experience would be both enlightening and entertaining.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hurdles and Hilarity: Navigating the Unexpected
&lt;/h3&gt;

&lt;p&gt;The path wasn't always smooth, and therein lay the charm. Imagine ChatGPT producing coding snippets that left us laughing or perplexed! While I intended for correct code, ChatGPT occasionally decided to provide unexpected new out of context snippets instead. These moments added a delightful twist, reminding me that collaboration with AI can indeed be an unpredictable thrill. With clever maneuvering, we learned to maintain context by reusing previously generated code, ensuring we stayed on course.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI Artistry: The Birth of the Icon
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7-VdbXO6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8msfgbeukgz8fbdvpc39.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7-VdbXO6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8msfgbeukgz8fbdvpc39.gif" alt="AI artistry" width="480" height="270"&gt;&lt;/a&gt;source:giphy&lt;/p&gt;

&lt;p&gt;Creating an app icon that resonates is a challenge, but it's a challenge we tackled with flair. ChatGPT described the icon's essence, and here's where DALL-E, another AI wonder, stepped in. Powered by DALL-E, the Bing Image Creator seamlessly turned textual descriptions into visual reality. As I added the finishing touches, the icon emerged as a stunning blend of AI innovation and my own creative touch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Designing the Journey: A UX Guided by AI
&lt;/h3&gt;

&lt;p&gt;User experience (UX) is paramount in any app's success. Here, ChatGPT's insights shone once again. From layout suggestions to subtle animation for user interactions, ChatGPT demonstrated a keen eye for design. Each recommendation was like a pixel of AI genius, contributing to a UX that would engage and delight users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Beyond Code: AI Deployment and the Future
&lt;/h3&gt;

&lt;p&gt;The adventure didn't conclude with the app's functionality and aesthetics. ChatGPT's guidance extended to deploying the app on Firebase through GitHub actions. Witnessing AI's influence throughout the development pipeline was an eye-opening experience, showcasing the power of collaboration between human minds and digital innovation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Embracing Progress: Challenges and Opportunities
&lt;/h3&gt;

&lt;p&gt;As we reached the end, it's essential to acknowledge the journey's imperfections. The app isn't yet fully optimized for mobile devices and responsive design, reminding us that progress is an ongoing endeavor. Embracing the challenges, however, is what drives us to refine our creations and reach new heights of excellence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Join the Adventure: Exploring the Web App
&lt;/h3&gt;

&lt;p&gt;But enough talk—let's experience it firsthand! I invite you to explore &lt;a href="https://chrono-chime.web.app"&gt;ChronoChime&lt;/a&gt; and discover the synergy between AI and human ingenuity. Navigate its features, experience its charm, and share your insights—because your feedback fuels the evolution of this exciting project.And don't forget to check out the &lt;a href="https://github.com/svijaykoushik/chorno-chime"&gt;GitHub Repo&lt;/a&gt; that houses the code driving this innovation&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/svijaykoushik"&gt;
        svijaykoushik
      &lt;/a&gt; / &lt;a href="https://github.com/svijaykoushik/chorno-chime"&gt;
        chorno-chime
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ChronoChime - Hourly Notification Progressive Web App (PWA) with background sounds and notifications.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
ChronoChime&lt;/h1&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/svijaykoushik/chorno-chime/blob/main/chrono-chime-icon-192.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zh4WPxKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/svijaykoushik/chorno-chime/raw/main/chrono-chime-icon-192.png" alt="ChronoChime Logo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Welcome to ChronoChime, an elegant Progressive Web App (PWA) that sends you hourly notifications along with a soothing chime. Stay on track and manage your time effortlessly with ChronoChime!&lt;/p&gt;
&lt;h2&gt;
Overview&lt;/h2&gt;
&lt;p&gt;ChronoChime is a PWA built using HTML, CSS, and JavaScript. It utilizes service workers for background notifications and caching, offering a seamless user experience.&lt;/p&gt;
&lt;h2&gt;
Deployment&lt;/h2&gt;
&lt;p&gt;To deploy ChronoChime, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clone the repository:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/svijaykoushik/chorno-chime.git&lt;/pre&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Navigate to the project directory:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;cd&lt;/span&gt; chorno-chime&lt;/pre&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose one of the following deployment methods:&lt;/p&gt;
&lt;h2&gt;
3.1 Apache or IIS&lt;/h2&gt;
&lt;p&gt;3.1.1 Set up your favorite web server (Apache, IIS, etc.).&lt;/p&gt;
&lt;p&gt;3.1.2 Copy the contents of the ChronoChime directory into your server's web root.&lt;/p&gt;
&lt;p&gt;3.1.3 Access ChronoChime by navigating to &lt;a href="http://localhost" rel="nofollow"&gt;http://localhost&lt;/a&gt; or the appropriate server address.&lt;/p&gt;
&lt;h2&gt;
3.2 Using the serve Package (Node.js)&lt;/h2&gt;
&lt;p&gt;3.2.1 Navigate to the project directory:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;cd&lt;/span&gt; chorno-chime&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;3.2.2 Run the serve command in the project directory:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;npx serve&lt;/pre&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
Screenshots&lt;/h2&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/svijaykoushik/chorno-chime./screenshot1.jpeg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mMBzlU5Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/svijaykoushik/chorno-chime./screenshot1.jpeg" alt="Screenshot 1"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/svijaykoushik/chorno-chime./screenshot2.jpeg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ah80pdoU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/svijaykoushik/chorno-chime./screenshot2.jpeg" alt="Screenshot 2"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
About&lt;/h2&gt;
&lt;p&gt;ChronoChime was…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/svijaykoushik/chorno-chime"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  The Future Awaits: A Collective Tech Adventure
&lt;/h3&gt;

&lt;p&gt;In a world where AI and human creativity are merging, the possibilities are endless. Our journey is an invitation to embrace this fusion, to tread the path of innovation with excitement and curiosity. Join the conversation, share your thoughts, and let's embark on a collective tech adventure where the extraordinary becomes the norm.&lt;/p&gt;

&lt;p&gt;And there you have it! As we conclude this journey into the world of AI-powered web app development, I want to share a behind-the-scenes tidbit that adds an extra layer of intrigue to our adventure.&lt;/p&gt;

&lt;p&gt;This article itself was crafted with the assistance of ChatGPT, an AI language model designed by OpenAI. ChatGPT helped me elaborate and share the experience of this adventure in a way that's engaging, cohesive, and captivating. It provided that extra spark that brought this story to life, adding an AI-powered touch to our journey.&lt;/p&gt;

&lt;p&gt;While ChatGPT's influence was felt in the crafting of these words, the heart of the story, the challenges overcome, and the excitement of the journey remain as real as ever. &lt;/p&gt;

&lt;p&gt;Our partnership is a prime example of how human creativity and AI innovation can join forces to create something truly exceptional.&lt;/p&gt;

&lt;p&gt;So, remember that AI is not just a tool—it's a collaborator, an enhancer, and an inspiration. Thank you for joining me on this adventure. Stay curious, stay creative, and keep pushing the boundaries of what's possible!&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledgement
&lt;/h2&gt;

&lt;p&gt;Cover &lt;a href="https://www.pexels.com/photo/a-robot-holding-a-flower-8438979/"&gt;Photo&lt;/a&gt; by Pavel Danilyuk&lt;/p&gt;

</description>
      <category>ai</category>
      <category>chatgpt</category>
      <category>javascript</category>
    </item>
    <item>
      <title>2019 Year in review</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Tue, 31 Dec 2019 13:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/2019-year-in-review-94k</link>
      <guid>https://forem.com/svijaykoushik/2019-year-in-review-94k</guid>
      <description>&lt;p&gt;2019 is a special year to me. It’s the year when I realized how much I love to write. It’s the year where you and the community on DEV.to drowned me with your love which made me start posting consistently after going silent for more than 6 months. As a roundup, I’m sharing you my experiences throughout this year. Don’t worry, It’s not that long.&lt;/p&gt;

&lt;h2&gt;
  
  
  Achievements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One of the greatest achievements this year is that I was selected as one of the TOP 500 authors on DEV&lt;/li&gt;
&lt;li&gt;One of my posts was featured in the top 7 posts of the week list&lt;/li&gt;
&lt;li&gt;And Finally, I posted consecutively for 4 weeks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Life lessons
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. A picture is worth a thousand words
&lt;/h3&gt;

&lt;p&gt;The saying “A picture is worth a thousand words” is very true. I know everyone knows that. But hear it from me. I learnt that you the reader prioritize and value a picture breaking down a git command explaining every part of it more than the paragraph that followed it explaining the same.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Read a book
&lt;/h3&gt;

&lt;p&gt;This is the most useful piece of advice from the community. Reading a good book when learning a new tool or a programming language helps you gain a deeper understanding of what you learn. This cannot be said to tutorials and guides because most of them are designed to be very short and specific. Thus, they cannot cover the smaller details that strengthen your foundation. One example is when I was learning git via tutorials, A tutorial taught me very clearly how to add files to a repository but it did not cover how to remove an unwanted file I accidentally added. If you can’t afford a book, just read the manual of whatever you’re learning clearly.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.Keep it simple stupid
&lt;/h3&gt;

&lt;p&gt;The one thing I learnt from the DEV community is that not every developer has a background in computer science. So, keeping my posts simple and by avoiding jargons or simplifying the jargons has been beneficial for the readers. I personally believe that if I can’t explain something in simple terms then I don’t understand it clearly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Knowledge
&lt;/h2&gt;

&lt;p&gt;On the technical side, I learnt several things this year.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Git
&lt;/h3&gt;

&lt;p&gt;I properly learnt to use git. I learnt about branching and workflows which is very helpful in writing my blog as it is hosted on GitHub pages. The GitHub workflow and branching helped write articles and push them without disturbing the live content of my blog. I also figured that using the command line is way easier and faster than using GUI clients like GitHub desktop.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Colour theory
&lt;/h3&gt;

&lt;p&gt;I made the first step in learning UI design by learning colour theory. Choosing the right colours was usually hard. I would just use the RGB colour picker to pick random colours for a colour scheme and it would just hurt my eyes. After learning about the colour wheel and about the monochrome, complementary, and triadic colour schemes, I now choose colours better and they are very pleasing to the eyes when compared to what I did before.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Pseudorandom number generators (PRNGs)
&lt;/h3&gt;

&lt;p&gt;I learnt how Math.random works and about PRNGS. What was amazing was the PRNG algorithms used not more than 10 lines of code and very basic math principles to generate a sequence of numbers that are seemingly random. The mind-blowing fact is that Math.random does not use any standard algorithm. It is decided by the browser vendors.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Typescript
&lt;/h3&gt;

&lt;p&gt;I learnt typescript, the language that I’ve been seeing in various blog posts. It turned-out that It’s not a new language and It, in my opinion, is just well-groomed JavaScript. I got very excited to know that I could use high-level OOP concepts that I learnt in languages like c++, java and C# in JS apps using typescript. The most favourites were “call signatures” and “interfaces”. TS just cured my anxiety on type errors within my app that is just laborious to fix.&lt;/p&gt;

&lt;p&gt;I would like to thank you for your love and support and I wish you a very happy new year. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ped0Kfxu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_12_31/newyearwishes.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ped0Kfxu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_12_31/newyearwishes.jpg" alt="New year wishes" width="640" height="637"&gt;&lt;/a&gt; Happy new year&lt;/p&gt;

&lt;p&gt;Cover image by Aidan Roof from Pexels&lt;/p&gt;

</description>
      <category>meta</category>
    </item>
    <item>
      <title>Wish you everyone a happy Diwali!</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Sat, 26 Oct 2019 17:51:57 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/wish-you-everyone-a-happy-diwali-4mm6</link>
      <guid>https://forem.com/svijaykoushik/wish-you-everyone-a-happy-diwali-4mm6</guid>
      <description>&lt;p&gt;Hello world,&lt;/p&gt;

&lt;p&gt;I'm sorry, I couldn't publish a post this week. I wanted to write about particle physics with JavaScript and html5 canvas. But the demo took too long to make and I was busy with Diwali shopping. So I present to you the video of the demo this week and the actual post next week.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Diwali, in the true sense, means ending all evils, cruelty and hatred &amp;gt; towards one another. Get together to celebrate the spirit of the festival.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Happy Diwali! ✨🎆🙌🏽&lt;/p&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>css</category>
      <category>canvas</category>
    </item>
    <item>
      <title>Hiding to reveal</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Sat, 19 Oct 2019 00:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/hiding-to-reveal-3n11</link>
      <guid>https://forem.com/svijaykoushik/hiding-to-reveal-3n11</guid>
      <description>&lt;h1&gt;
  
  
  Achieving Fluent design’s Reveal Highlight effect with CSS and JavaScript
&lt;/h1&gt;

&lt;p&gt;Hello, world!&lt;/p&gt;

&lt;p&gt;Last time I wrote an article about creating the Fluent Design system’s acrylic effect dubbed the “blurry glass effect” with CSS, you loved it. So, in response to your love, I’m going to share my experience of making yet another captivating effect called the “edge sheen effect”.&lt;/p&gt;

&lt;p&gt;A sheen is a streak of light visible on the edges of objects with glossy surface. This “edge sheen effect” is used to highlight the interactive elements in the app that are neighbouring to one another. You can see this effect in the Start menu and the command buttons in various apps.&lt;/p&gt;

&lt;p&gt;I love this effect so much. What sets apart this effect from other highlight effects used across the web is it only lights up the edge(s) near to the pointer. And to top it, the streak moves along with the mouse. It’s so mesmerizing! Every time I see this effect, my eyes widen, brain tingle and face smile. I play with this effect every time I notice it in an app. In the real world, you can see this effect on every smartphone ad.&lt;/p&gt;

&lt;p&gt;This effect is called the “Reveal Highlight” in the Fluent Design System.&lt;/p&gt;

&lt;p&gt;Like the Acrylic Material effect, I wanted to know whether I could do it with CSS.&lt;/p&gt;

&lt;p&gt;In the preliminary research, I visited the documentation for the Reveal highlight effect for its recipe. It seemed simple. I tried it by creating a tile layer and added a content layer within it. For the edge sheen, I used gradient borders for the tile layer. I used the &lt;code&gt;border-image-source&lt;/code&gt; property for this. But I didn’t know how to move the gradient with the mouse. And making only the borders near to the pointer visible was a bit difficult.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://jsfiddle.net/svijaykoushik/k9ohpeux//embedded/result//dark" width="100%" height="600"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;So, I checked if I could find some help on the internet. After several attempts with different search term, I found that code pen users &lt;a href="https://codepen.io/RumyantsevMichael"&gt;Michael&lt;/a&gt; and &lt;a href="https://codepen.io/Sepshun"&gt;Shepshun&lt;/a&gt; had already implemented the effect. And GitHub user &lt;a href="https://github.com/d2phap"&gt;d2phap&lt;/a&gt; went one step further and had made a JavaScript plugin for the effect 😮. I was just late to the party.&lt;/p&gt;

&lt;p&gt;But none of them had explained how they achieved this effect. Using this opportunity, I’ll explain to you how to make the effect.&lt;/p&gt;

&lt;p&gt;The key to the effect is to add a background plate with a radial gradient from white to transparent behind the content and make the background plate is slightly bigger than the content layer so that it appears like a border to the content layer. Bear with me. Let me explain.&lt;/p&gt;

&lt;p&gt;I modified my previous recipe by transforming the tile layer into the background plate and called it the edge sheen layer. Then I added three child container elements to it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A back colour layer to display the background colour of the element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A hover layer to display the hover effect. I’ll be telling you about this later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And a content layer to hold the content of the element.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KW8enLWP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_10_19/edge_sheen_efecct.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KW8enLWP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_10_19/edge_sheen_efecct.jpg" alt="Recipe for edge sheen effect" width="800" height="600"&gt;&lt;/a&gt; &lt;em&gt;Recipe for edge sheen effect&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I arranged all these child layers exactly to the centre of the edge sheen layer with flexbox. I reduced the dimensions of the back colour layer so that the edge sheen layer looked like the border of the back colour layer.&lt;/p&gt;

&lt;p&gt;To move the sheen with the mouse, I tracked the coordinates of the pointer with the mouse move event and moved the position of the gradient with it. This made it appear like the borders lit up only when the mouse was near.&lt;/p&gt;

&lt;p&gt;The next part of the reveal highlight effect is the faint gloss that appears and moves with the mouse over the back colour layer when the mouse hovers above the element. I achieved this effect using the hover layer that I added beforehand. The gloss was created with the same white to transparent radial gradient as the background for the hover layer. With the previously tracked mouse coordinates, I moved the gloss within the element. By using the mouse enter and mouse leave events, I toggled the gloss whenever the mouse moved in and out of the element.Here is how it looks.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://jsfiddle.net/svijaykoushik/8o5a9j0x//embedded/result//dark" width="100%" height="600"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;To enjoy the beauty of the “edge sheen” effect, multiple interactive elements need to be near one another using the effect. So, I made a demo with multiple elements in an asymmetric grid. Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://jsfiddle.net/svijaykoushik/n72jwx5u//embedded/result//dark" width="100%" height="600"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Also, here's a video demo of the effect&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/yC1I0LOoiSI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@alex-hussein-1391461?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Alex Hussein&lt;/a&gt; from &lt;a href="https://www.pexels.com/photo/man-and-woman-standing-on-seashore-2685039/?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Pexels&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://codepen.io/RumyantsevMichael/pen/qKWeEK"&gt;Fluent design - Reveal highlight&lt;/a&gt;, by &lt;a href="https://codepen.io/RumyantsevMichael"&gt;Michael&lt;/a&gt; - CodePen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://codepen.io/Sepshun/pen/YEXKNy"&gt;Microsoft Fluent Design (Reveal Highlight)&lt;/a&gt; by &lt;a href="https://codepen.io/Sepshun"&gt;Shepshun&lt;/a&gt; - CodePen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://d2phap.github.io/fluent-reveal-effect/"&gt;fluent-reveal-effect&lt;/a&gt; by &lt;a href="https://github.com/d2phap"&gt;d2phap&lt;/a&gt; - Github&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
      <category>fluentdesign</category>
    </item>
    <item>
      <title>My thoughts on TypeScript</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Mon, 14 Oct 2019 00:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/my-thoughts-on-typescript-2o7</link>
      <guid>https://forem.com/svijaykoushik/my-thoughts-on-typescript-2o7</guid>
      <description>&lt;p&gt;When I was a child, I used to play construction with my Dad’s music cassette collection. Sometimes, I would mix up the cases and the cassettes inside for fun. When my Dad wanted to listen to the music he liked, he would be disturbed when a completely different song play. And he would be frustrated when he couldn’t find the real one.&lt;/p&gt;

&lt;p&gt;I feel the same frustration whenever I try to access a property in a JavaScript object that is supposed to be available and It doesn’t exist.&lt;/p&gt;

&lt;p&gt;JavaScript gives me “God” like powers where I can create objects in one form and change it into something different at my whim. Like turning a fox into a horse or turning blood to wine. But this power gave me problems just like how I gave my dad problems.&lt;/p&gt;

&lt;p&gt;If I had the magic lamp, I would ask Genie Smith to find me a way to designate types to data &amp;amp; objects when I write code and not when I execute it. And he would’ve said “Dude you can use TypeScript. It has what you need”.&lt;/p&gt;

&lt;p&gt;If you don’t know what TypeScript is, it is an open source programming language designed to provide type-safety to JS projects with its strict type system.&lt;/p&gt;

&lt;p&gt;After learning typescript for a week, here are my thoughts on TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A Super set of JavaScript
&lt;/h2&gt;

&lt;p&gt;Typescript uses the same syntax as JavaScript with nifty additional features. And I love it.&lt;/p&gt;

&lt;p&gt;Typescript is just like JS but has a strict syntactic structure with stringent datatype rules. I would say it as a meta-data to JavaScript as it gives additional information about types and object structures. It kind of reminds me of C++.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Type safety
&lt;/h2&gt;

&lt;p&gt;The type system in TypeScript, the set of rules on how to assign data types or types for short to variables, objects and other elements of my code is very stringent. This ensures that I do not assign a Person object to an Animal object or add a string with a number. This is called type safety in computer programming. Though JavaScript has type safety, it’s more lenient in my opinion.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A bouncer
&lt;/h2&gt;

&lt;p&gt;I feel that typescript is like a bouncer in a bar who push away people when they do not follow the party etiquettes. It’s because TS pushes me back whenever there is an inadvertent type-related error until I fix it. It might seem tedious, It’s helpful nonetheless. The TS compiler helped me prevent spending a lot of time to debug the error which is the case in JS.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Code Hinting
&lt;/h2&gt;

&lt;p&gt;My favourite part of typescript is its ability to present hints while I code. When combined with powerful code editors like VS Code or Atom, the contextual code suggestions helped me reduce errors and increased my typing speed. TS can do this because it’s a statically typed language. It means information about types are available to the compiler before the compilation starts. This availability of information helps the editors compile my code on the go and provide contextual suggestions.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Red squiggly lines
&lt;/h2&gt;

&lt;p&gt;Available separately the linter when enabled in the editor, can detect errors of syntactic, type and even contextual nature. It presents the errors by underlining the error part with red squiggly lines as I type. This makes error correction easier and faster&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Planning Ahead
&lt;/h2&gt;

&lt;p&gt;New nifty features in typescript like the call signatures, object structure definition and interfaces allow me to plan ahead on how I’ll be applying my design to the code. For example, the call signatures are similar to function declaration in C allow me to sketch out the number of parameters needed and the return type. And the Object structure definition allows me to design a skeleton for an object before I define it.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Versatility
&lt;/h2&gt;

&lt;p&gt;What makes typescript versatile is its wide variety of configuration options. I can enable and disable different options to cater to my project’s needs.&lt;/p&gt;

&lt;p&gt;One of the settings I used a lot is the target option. It flipped between commonJS module system and the es5 module system while learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Just too many options
&lt;/h2&gt;

&lt;p&gt;TS has just too many configuration options for a beginner. The ignorance of the purpose of some of these options led me to trouble. I did not know I had to include a separate library to use the DOM functions. I was like “What do you mean getElementById is not defined?”&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Type definition
&lt;/h2&gt;

&lt;p&gt;What makes typescript great is, it allows programmers to define new types for their need. Making use of this feature the definitely.org community has created high-quality type definitions for popular JS frameworks like JQuery, node.js and Angular which allows the use of these frameworks in Typescript.&lt;/p&gt;

&lt;p&gt;But, could not find enough information on how to use a JS plugin or framework if it is not supported by the definitely typed community.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Partial to node.js
&lt;/h2&gt;

&lt;p&gt;Typescript has so many features that I found useful. But in terms of documentation, it is partial to node.js. I found lots of learning aids about TS for node.js. But I couldn’t find equivalent amounts of learning aids for front end programming.&lt;/p&gt;

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

&lt;p&gt;As a beginner, all these strict rules felt time-consuming since it took less time to write the same in JS. Over time, I realized the usefulness of TS and started using its features as I learnt them. I’ve decided to use typescript in my next side project instead of JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;“Programming TypeScript, Making your Javascript applications to scale” by Borris Cherney. ISBN - 9781492037651&lt;/li&gt;
&lt;li&gt;“Type system”, &lt;a href="https://en.wikipedia.org/wiki/Type_system"&gt;Wikipedia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;“Data type”, &lt;a href="https://en.wikipedia.org/wiki/Data_type"&gt;Wikipedia&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>thoughts</category>
      <category>beginners</category>
    </item>
    <item>
      <title>3 Amazing ways to generate random numbers without Math.random()</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Fri, 04 Oct 2019 00:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/3-amazing-ways-to-generate-random-numbers-without-math-random-4e84</link>
      <guid>https://forem.com/svijaykoushik/3-amazing-ways-to-generate-random-numbers-without-math-random-4e84</guid>
      <description>&lt;p&gt;Have you ever played an online spin to win game? You know! The one that pops up as an Ad with the message “Spin this to win the latest, feature-rich Samsung smartphone!”? I did. Because who doesn’t want the latest smartphone for free? Sadly, no matter how many times I played, I didn’t win. Never the less, I was rewarded. Rewarded with the curiosity to know how this deceitful game worked. With a quick google search, I found that it worked by using a random number generator (RNG). It’s probably Math.random()&lt;/p&gt;

&lt;p&gt;But… How does a computer, a device that is designed to work as per the instructions given by a human generate random numbers? Answer, it doesn’t. And it can’t. That is why it’s called a “pseudo” random number generator (PRNG). It means it’s a fake. It’s a knock-off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a knock-off?
&lt;/h2&gt;

&lt;p&gt;A True RNG needs additional hardware that can use real-world random phenomena from throwing dice 🎲 to measuring radiation from a radioactive material as an input to generate random numbers. Wow! Using the randomness in radioactive decay just to generate a number is mind-blowing! 🤯 Take a moment to let that sink in.&lt;/p&gt;

&lt;p&gt;But this additional hardware is costly and who would willingly carry a radioactive material in their pockets except for Lex Luthor? That is why everyone agreed to settle with a PRNG.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Flex_luthor_with_kryptonite.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Flex_luthor_with_kryptonite.jpg" alt="lex_luthor_with_kryptonite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PRNG is not a single standard algorithm used everywhere. I was struck dumb when I found out that there are not 1, not 2 but 28 different algorithms created by very smart people over the past 7 decades.&lt;/p&gt;

&lt;p&gt;Let me show you 3 amazing ways to replace &lt;code&gt;Math.random()&lt;/code&gt; in Javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do they work?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Pseudo Random Number Generator (PRNG) refers to an algorithm that uses mathematical formulas to produce sequences of random numbers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="https://www.geeksforgeeks.org/pseudo-random-number-generator-prng/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/pseudo-random-number-generator-prng/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Though I couldn’t research all the 28 algorithms in a short time, I looked up 3 good ones. I first thought they used complex mathematical derivatives involving 100s of lines of code. Nope! I was wrong. With 2 to 5 lines of code involving basic arithmetic operations, they’re unbelievably simple. This makes it easier for beginners to understand.&lt;/p&gt;

&lt;p&gt;All 3 algorithms and PRNGs, in general, followed these common steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;All these algorithms accept an input called the seed 🌱 number. This is the base number on which the formula is applied. Some algorithms can take other inputs as required by the mathematical operation to be performed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They, then apply the inputs on the formula and the result generated is the random number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The generated number is used as the seed for the next run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These steps are repeated to create a sequence of numbers that make us believe they are random.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Ffun_fact.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Ffun_fact.jpg" alt="Fun fact"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An unique property that separates PRNGs from true RNGs is that the sequences generated by PRNGs inevitably repeat themselves at one point of time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/J2Tjf7zZjfaVlOVORy/200w_d.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/J2Tjf7zZjfaVlOVORy/200w_d.gif" alt="Repitions are inevitable with thanos"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Middle square method (MSM)
&lt;/h2&gt;

&lt;p&gt;Invented by John von Neumann and described in 1946, the Middle Square Method (MSM) is the first-ever method designed to generate pseudo-random number sequences &lt;sup&gt;[1]&lt;/sup&gt;. Implementing this method is a child’s play. For an n-digit random number sequence,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Start with an n-digit number as the seed. Let’s say it’s a 2-digit number 42.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Square it. Here, the square of 42 is 1764.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extract the middle n-digits of the squared number to get the next number in our sequence. In our case, the next number would be 76.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the result as the seed and repeat steps 1-4 for the next cycle.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FMiddle_square_method.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FMiddle_square_method.jpg" alt="Representation of middle square method"&gt;&lt;/a&gt; Representation of middle square method&lt;/p&gt;

&lt;p&gt;The simple nature of the algorithm is used as an exercise for beginner programmers to check their knowledge in the language they learned in Bootcamp. So, here’s my implementation in JS to help them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**

* Middle Square Method implementation in JavaScript

* for a 2-digit random number sequence

**/

var seed;

function middleSquareMethod(){

    var result = (seed * seed).toString().slice(1, 3); // extracting the middle value.

    seed = parseInt(result);

    return parseInt(result);

}

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

&lt;/div&gt;



&lt;p&gt;There is a problem with this approach. There are exceptional numbers whose square value have odd digits which makes it difficult to extract the middle digits like in the case of 15. Squaring 15 would result in 225. And we cannot accept 2 as the middle number since we need two digits. To solve this, we pad zeroes in front of the square value to make it even digits. Now 225 becomes 0225 which makes it easy to extract the middle 2 digits which is 22. After rectifying the problem, the code looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**

* Middle Square Method implementation in JavaScript

* for a 2-digit random number sequence

**/  

var seed = 42;

function middleSquareMethod(){

    var result = (seed * seed).toString().padStart(4,"0").slice(1, 3);
    // pad with zero when necessary and extract the middle value.

    seed = parseInt(result);

    return parseInt(result);

}

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

&lt;/div&gt;



&lt;p&gt;With just three lines of code, we could generate a maximum of 8&lt;sup&gt;n&lt;/sup&gt; numbers for an n-digit number after which the sequence repeats itself. There is a pitfall though. Some seeds can cause the algorithm to have a shorter cycle like the seed 25, which causes the algorithm to repeat 25 indefinitely.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Linear Congruential Generator (LCG) algorithm
&lt;/h2&gt;

&lt;p&gt;This fascinating algorithm uses more math than MSM. The LCG uses a linear equation that involves congruence operation for the generation of a random sequence of numbers. “Whoa! What’s all these fancy terms?” I can hear you exclaiming. Let me explain.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Linear means an algebraic equation that has no variables raised to the power greater than one.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Congruential means an equation that uses modulus division operation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With its jargons, the algorithm might seem sophisticated. But, it’s very simple to understand as it uses very basic algebra and arithmetic operations. It uses this particular equation &lt;strong&gt;Xn+1 = (aXn + c) mod m&lt;/strong&gt;. Alright! Alright! No more math terms. I’ll translate it to programmer readable from. The translated equation is, &lt;code&gt;X = (a * X + c) % m&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Where X is the seed. Akin to the MSM the result is used as the seed for the next cycle.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;a – is the multiplier&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;c – is the increment and&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;m – is the modulus&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It has the following conditions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;m &amp;gt; 0, duh! divide by zero is impossible&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0 &amp;lt; a &amp;lt; m&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0 ≤ c &amp;lt; m and&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0 ≤ X &amp;lt; m&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since this is a simple equation, solving this is a piece of cake for computers. In the case of the MSM, data conversion from number to string and back to number is required, which are heavy on the CPU. For this reason, LCG is the oldest and best-known random number generator algorithm &lt;sup&gt;[2]&lt;/sup&gt;. And hence takes 2&lt;sup&gt;nd&lt;/sup&gt; in the list.&lt;/p&gt;

&lt;p&gt;After all, both the increment and the seed can take the value zero care should be taken that both do not take zero or else it just spits out a sequence of zeroes.&lt;/p&gt;

&lt;p&gt;Here’s how I wrote the LCG in JS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* Implementation of the Linear congruential generator
* algorithm in JavaScript
*/
var X,a,c,m;

linearCongruentialGenerator(){

    X = (a * X + c) % m;

    return X;

}

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

&lt;/div&gt;



&lt;p&gt;It takes just two lines. Just two! I did a double-take after writing it 😲. It’s really incredible to see a simple equation to achieve something this big. This just increased my respect for Math.&lt;/p&gt;

&lt;p&gt;With the right combination of inputs, we could generate a very long sequence. Longer than the MSM before it starts repeating itself. In my example I used the values a = 1664525, m = 2&lt;sup&gt;32&lt;/sup&gt; and c = 1013904223 as used in &lt;a href="https://en.wikipedia.org/wiki/Numerical_Recipes" rel="noopener noreferrer"&gt;Numerical Recipes&lt;/a&gt; &lt;sup&gt;[3]&lt;/sup&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Xorshift algorithm
&lt;/h2&gt;

&lt;p&gt;The third algorithm in the list is the Xorshift algorithm. I’ve saved this special one for the last. If the MSM is easier to understand for humans and the LCG is understandable by both humans and computers then the XOR shift algorithm is easily understandable only to computers. Because this method, as the name suggests, uses the special and rarely used binary operations Xor and bit shift.&lt;/p&gt;

&lt;p&gt;Please bear with me. This one uses a lot of computer science terms. I chose this one because I thought I would never get to use those binary operators in my life just like how I thought I could never see Ash Ketchum win the Pokémon league championship.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Fash_wins_alola.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Fash_wins_alola.jpg" alt="ash wins alola"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me break down the algorithm. Bit shifting works by shifting the bits in the binary number either to the left or right. The result is a completely different number. For 1-bit shift to left, each bit is shifted one place to the left. The empty space is filled with 0 and the shifted out bit is discarded. And for a 5-bit shift to the left, single-bit shift operation is repeated 5 times. Here is an example:&lt;/p&gt;

&lt;p&gt;The binary equivalent of 4210 in a 16-bit representation is 00000000001010102.&lt;br&gt;&lt;br&gt;
After shifting 5 bits to the left it becomes 00000101010000002 which is the binary equivalent of 134410.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FBitshiftleft_1_bit.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FBitshiftleft_1_bit.jpg" alt="Bit shift left"&gt;&lt;/a&gt; Representation of 1-bit shift left operation in a 8 bit system&lt;/p&gt;

&lt;p&gt;And if we shift the binary equivalent of 252410 – 00001001110111002 5 bits to the right it becomes 00000000010011102 which is 7810 in decimal. The rest of the bits on the right side is discarded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FBitshiftright_1_bit.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2FBitshiftright_1_bit.jpg" alt="Bit shift right"&gt;&lt;/a&gt; Representation of 1-bit shift right operation in a 8 bit system&lt;/p&gt;

&lt;p&gt;The bit shift operation, as you can see, requires only one operand and the result is a completely different number. On the other hand, the Xor operation requires two operands. XOR short for Exclusive OR operation compares the bits of two binary numbers and sets the bit of the result to 1 only when one of the bits in comparison is 1. Continuing with the previous example the Xor of 42 and 2524 takes place like this:&lt;/p&gt;

&lt;p&gt;4210 – 00000000001010102&lt;/p&gt;

&lt;p&gt;252410 – 00001001110111002 XOR - 00001001111101102 which is the equivalent of 255010.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Fxor.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2Fprng-in-js%2Fxor.jpg" alt="xor operation"&gt;&lt;/a&gt; Representation of xor operation in a 8 bit system&lt;/p&gt;

&lt;p&gt;Xor also results in a different number. This algorithm combines the power of these two operations. And, here is my implementation of Xorshift in JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* Implementation of XorShift
* algorithm in JavaScript
*/
var seed;

function xorShift(){

  seed ^= seed &amp;lt;&amp;lt; 13;

  seed ^= seed &amp;gt;&amp;gt; 17;

  seed ^= seed &amp;lt;&amp;lt; 5;

  return seed;
}

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

&lt;/div&gt;



&lt;p&gt;This method performs consecutive bits shifts and Xor operations on the seed which creates a random sequence containing both positive and negative numbers. The constants 13, 17 and 5 in the algorithm is from the list of triplets suggested in the paper describing the Xor-shift algorithm &lt;sup&gt;4&lt;/sup&gt;. This algorithm works directly in binary, the language of the computers, which makes it faster than the LCG.&lt;/p&gt;

&lt;p&gt;If you want only positive numbers, you can take the 2’s complement of the seed if it’s negative before returning the value. This can reduce the performance with the inclusion of a condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* Implementation of XorShift
* algorithm in JavaScript
* with 2's complement
*/
function xorShift(){

  seed ^= seed &amp;lt;&amp;lt; 13;

  seed ^= seed &amp;gt;&amp;gt; 17;

  seed ^= seed &amp;lt;&amp;lt; 5;

  return (seed &amp;lt;0)?~seed+1: seed;
//2's complement of the negative result to make all numbers positive.
}

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

&lt;/div&gt;



&lt;p&gt;Computers store the positive and negative numbers (called signed integers) as binary numbers in 2’s compliment from. The leftmost bit (the most significant bit) is reserved to represent the sign of the number. 0 represents a positive (+) sign and 1 stands for negative (-) sign.&lt;/p&gt;

&lt;p&gt;Do you know what a two’s complement is? Don’t worry I’ll explain.&lt;/p&gt;

&lt;p&gt;In 2’s complement, A binary number say 11111111 11010011 (-4510) is taken and its bits are flipped. Meaning, 0s are made to 1s and vice versa. And finally, 12 is added to the flipped number. The result 00000000 001011012,is the positive form of the number (4510).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;-4510 ➡ 11111111 110100112&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bit inversion&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;00000000 001011002&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Add 1&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;00000000 001011002 + 12&lt;/p&gt;

&lt;p&gt;00000000 001011012 ➡ 4510&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thus, in our algorithm, we always end up with positive numbers.&lt;/p&gt;

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

&lt;p&gt;This article is just the tip of the iceberg in the rabbit hole of PRNGs. I wanted to share you the different ways to replace &lt;code&gt;Math.random()&lt;/code&gt;. All these samples give out whole numbers which is the complete opposite of Math.random(). Math.random() spits out random decimal numbers only between 0 and 1. I’ll leave the conversion as an exercise to you. You can use ES5 features like generator functions to implement these. If someone does that, please post it in the comments.&lt;/p&gt;

&lt;p&gt;Thanks for reading 😊&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;sup&gt;[1]&lt;/sup&gt; “List of pseudo random number generators”, Wikipedia.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;sup&gt;[2][3]&lt;/sup&gt; “Linear congruential generator”, Wikipedia.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;sup&gt;[4]&lt;/sup&gt; “Xorshift RNGs” [pdf] by Marsaglia, George, The journal of statistical software.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cover image credit: Image by &lt;a href="https://pixabay.com/users/PIRO4D-2707530/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=2017904" rel="noopener noreferrer"&gt;PIRO4D&lt;/a&gt; from &lt;a href="https://pixabay.com/users/PIRO4D-2707530/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=2017904" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>algorithms</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Learning TypeScript: Hello world with DOM manipulation</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Fri, 27 Sep 2019 00:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/learning-typescript-hello-world-with-dom-manipulation-56d1</link>
      <guid>https://forem.com/svijaykoushik/learning-typescript-hello-world-with-dom-manipulation-56d1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Every TypeScript example and tutorial I have found thus far is about language features, Static typing, Visual Studio, etc. I cannot find anything to tell me how I should be using it with reference to JavaScript and the DOM.&lt;/p&gt;

&lt;p&gt;My understanding it you can use TypeScript for the DOM. But, I never see anyone using it for that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Said &lt;a href="https://stackoverflow.com/users/28045/johnny"&gt;johnny&lt;/a&gt; in a &lt;a href="https://stackoverflow.com/questions/43210642/is-typescripts-purpose-to-be-used-for-manipulating-the-dom-like-javascript-is"&gt;question&lt;/a&gt; on stackoverflow.com. A while back I had the same question. Can We Use Typescript to manipulate the DOM?&lt;/p&gt;

&lt;p&gt;Hello world! &lt;/p&gt;

&lt;p&gt;I’ve been learning Typescript for a week now. I got into typescript when I wanted to learn the new Angular. Since it is based on Typescript, I decided to learn Typescript. During learning, I found it odd that none of the learning aids I used included examples of using the language with HTML. Every example I saw in those learning aids and some other tutorials I then looked up involved only node.js. More googling landed me on StackOverflow where johnny, as I mentioned before, had the same question. using this as an opportunity to make a post after almost a year, I’ve made this post, the missing piece of the puzzle, in hopes that it would land first instead of johnny’s question on StackOverflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;Using the DOM or Dom manipulation in typescript is simple. All I needed to do was to use the types defined specifically for DOM access that is available in Typescript. The rest was the same as in JavaScript. But… these “DOM types” are not available out of the box with Typescript. I needed to explicitly configure the typescript compiler to include the “dom” library in the &lt;code&gt;compilerOptions&lt;/code&gt; section in the configuration file&lt;sup&gt;[2]&lt;/sup&gt; to access the DOM types in my project. &lt;em&gt;“Why didn’t they include by default?. Maybe the creators didn’t intend to use it primarily for front end development”&lt;/em&gt; I thought to myself.&lt;/p&gt;

&lt;p&gt;Some other configuration changes I made were: I enabled &lt;code&gt;strict&lt;/code&gt; mode for strict type checking and I changed the &lt;code&gt;target&lt;/code&gt; from “common JS” to “es5”, so the compiler can output JS for browsers and not for node.js. I also added the “es2015” library so that I could use functionalities like arrays and Math functions for my example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* tsconfig.json
* Configuration file in the project folder for the Typescript compiler
*/
{
    "compilerOptions": {
        "lib": [
            "es2015",
            "dom"
        ],
        "strict": true,
        "target": "es2015"
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Hello world
&lt;/h2&gt;

&lt;p&gt;In this article, I’m going to write a hello world program to demonstrate the use of DOM in typescript. Because it’s my first post on typescript. I’ll be covering the basics of using the DOM types and a problem a beginner like me would face while doing this the first time. I’m not covering DOM events here. I’ll be covering them in another article coming soon.&lt;/p&gt;

&lt;p&gt;I’ll begin with the basics where I change the inner text value of an existing element. I started by creating an HTML file with a simple html5 boilerplate with a &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element with id greeter saying “hello” inside the body.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&amp;gt;
    &amp;lt;title&amp;gt;Hello world&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1 id="greeter"&amp;gt;Hello&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then, I opened a new typescript file and added the following code&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let greeter:HTMLHeadingElement = document.getElementById("greeter");

greeter.innerText = "Hello world!";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--euY0MQHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-type-declaration.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--euY0MQHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-type-declaration.jpg" alt="Typescript type declaration" width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the code, I created a variable greeter and I assigned the type &lt;code&gt;HTMLHeadingElement&lt;/code&gt; to it. The &lt;code&gt;HTMLHeadingElement&lt;/code&gt; type which is defined in the “dom” library we added to the configuration, tells the compiler that the greeter variable expects an Html heading element and nothing else. And, I assigned the greeter to the value returned by the function &lt;code&gt;getElementById&lt;/code&gt; which returns the element with the ID provided. Then I assigned the string “hello world” to the &lt;code&gt;innerText&lt;/code&gt; property of the greeter element.&lt;/p&gt;

&lt;p&gt;When I compiled the code with the command&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:&amp;gt; tsc script.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pVo1yhEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-compile-command.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pVo1yhEV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-compile-command.jpg" alt="Typescript type declaration" width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It threw the following error&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;| Type ‘HTMLElement | null’ is not assignable to type ‘HTMLHeadingElement’. |&lt;/p&gt;

&lt;p&gt;Type ‘null’ is not assignable to type ‘HTMLHeadingElement’.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Bummer! My first attempt failed. On the bright side, Typescript is doing its job and the configurations I set up works. The error means that, I tried to assign greeter which is of type &lt;code&gt;HTMLHeadingElement&lt;/code&gt; with an object of type &lt;code&gt;HTMLElement&lt;/code&gt; that the method &lt;code&gt;getElementById&lt;/code&gt; returned. &lt;code&gt;HTMLElement | null&lt;/code&gt; in the error message means that the method’s return value can be either of type &lt;code&gt;HTMLElement&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;. The special operator &lt;code&gt;|&lt;/code&gt; is called the union operator. I won’t be explaining “union types” in this article. You can learn about them &lt;a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html#union-types"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;HTMLElement&lt;/code&gt; type is just a common interface for all the html elements&lt;sup&gt;[1]&lt;/sup&gt; but the compiler expects a &lt;code&gt;HTMLHeadingElement&lt;/code&gt;. I thought of changing the greeter variable’s type to &lt;code&gt;HTMLElement&lt;/code&gt; but I didn’t. Because, it’s not right. If I had changed it to &lt;code&gt;HTMLElement&lt;/code&gt;, it means greeter could accept any HTML element from the DOM. I wanted it to accept only a heading element. So, I used &lt;em&gt;type assertion&lt;/em&gt; feature of typescript (Learn about type assertion &lt;a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions"&gt;here&lt;/a&gt;) to tell the compiler that the element returned from the getElementById is indeed a heading element and it doesn’t have to worry about it. Here’s the fixed code:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let greeter:HTMLHeadingElement = document.getElementById("greeter") as HTMLHeadingElement;

greeter.innerText = "Hello world!";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bVv3lINO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-type-assertion.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bVv3lINO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-type-assertion.jpg" alt="Typescript type declaration" width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, the compilation was a success. I included the script.js file generated by the compiler in the Html document and opened it on a browser. It looked like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pa3-Kfge--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-screenshot-no-style.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pa3-Kfge--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-screenshot-no-style.png" alt="Typescript type declaration" width="811" height="662"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Decoration time
&lt;/h3&gt;

&lt;p&gt;Now that I’ve made sure that everything works as intended, It was time to decorate the page. I wanted a font style that is not formal looking. After browsing through google fonts, I chose &lt;em&gt;Rock Salt&lt;/em&gt;. I imported it in my stylesheet along with &lt;em&gt;Dancing Script&lt;/em&gt; as a secondary font using CSS imports. I then proceeded by adding a few more elements to the Html document. I centered all the text using CSS flexbox, added a nice background from &lt;a href="https://uigradients.com/#CanYouFeelTheLoveTonight"&gt;UI gradients&lt;/a&gt;, and adjusted positions of some elements to arrange them properly. The page now looked beautiful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sh3iuI8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-screenshot-bg-and-font.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sh3iuI8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_09_27/ts-screenshot-bg-and-font.png" alt="Typescript type declaration" width="811" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, to place the cherry on top, I wanted to add a pretty background animation of orbs rising to the top like bubbles to the page. To make the orbs I decided to use &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements. Since I wanted several of these orbs with different sizes, I split the task into two so the work could be simplified. One, I created a common style for all the orbs and created a custom animation for the orbs in CSS. And two, I created the orbs dynamically with the help of typescript by creating a set number of &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements, assigning them the style created beforehand and randomizing their sizes, positions, and animation-delay to make them look more natural.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
.
.
function createBubbles() {

 for (let i = 0; i &amp;lt; bubbleCount; i++) {

 let div: HTMLDivElement = document.createElement("div") as HTMLDivElement;

 let divSize = getSize();

 div.style.left = getLeftPosition() + "px";

 div.style.width = divSize + "px";

 div.style.height = divSize + "px";

 div.style.animationDelay = i * randomFloat(0, 30) + "s";

 div.style.filter = "blur(" + randomFloat(2, 5) + "px)";

 div.classList.add("bubble");

 bubbleBuffer.push(div);

 }

 console.log("Bubbles created");

}
.
.
.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Finally, I added the orbs to the dom like this and thereby kickstarting the animation&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
.
.
function releaseBubbles() {

 createBubbles();

 for (let i = 0; i &amp;lt; bubbleCount; i++) {

 containerDiv.appendChild(bubbleBuffer[i]);

 }

 console.log("Bubbles released");

}
.
.
.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here’s the final output &lt;a href="https://youtu.be/tX8P-W_jNjI"&gt;on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/tX8P-W_jNjI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;And the the repo containing the complete code&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/svijaykoushik"&gt;
        svijaykoushik
      &lt;/a&gt; / &lt;a href="https://github.com/svijaykoushik/learning-typescript"&gt;
        learning-typescript
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Examples and demos as part of the series learning typescript on my blog :earn from my experience
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



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

&lt;p&gt;During writing this article and the example, I realized the involvement of advanced concepts like type assertion and union types. I now understand why the authors of those tutorials didn’t include them. If included, it would have confused beginners outright. I think it’s best to learn typescript well before starting to use DOM in your projects.&lt;/p&gt;

&lt;p&gt;In my example, I skipped the null checking when I fixed the type mismatch error as it seemed unnecessary for the example but you should check for nulls when necessary to avoid breaking your app at runtime. I also skipped the part where I added animations using the animate.css plugin for the text as it felt trivial explaining it.&lt;/p&gt;

&lt;p&gt;Finally, I need to thank &lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__40736"&gt;
    &lt;a href="/tinmanjk" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RMot00hd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--youyJC6G--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/40736/7e2ee167-abb6-4c56-94bb-55185ac8627b.jpeg" alt="tinmanjk image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/tinmanjk"&gt;Ivan Petrov&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/tinmanjk"&gt;/tinmanjk&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
 &lt;a href="https://dev.to/tinmanjk"&gt;Ivan Petrov&lt;/a&gt; for suggesting me to read a book when learning a new tech in a comment &lt;div class="liquid-comment"&gt;
    &lt;div class="details"&gt;
      &lt;a href="/tinmanjk"&gt;
        &lt;img class="profile-pic" src="https://res.cloudinary.com/practicaldev/image/fetch/s--G8aWPodp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--wxMlKnXw--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_50%2Cq_auto%2Cw_50/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/40736/7e2ee167-abb6-4c56-94bb-55185ac8627b.jpeg" alt="tinmanjk profile image"&gt;
      &lt;/a&gt;
      &lt;a href="/tinmanjk"&gt;
        &lt;span class="comment-username"&gt;Ivan Petrov&lt;/span&gt;
      &lt;/a&gt;
      &lt;span class="color-base-30 px-2 m:pl-0"&gt;•&lt;/span&gt;

&lt;a href="https://dev.to/tinmanjk/comment/8noi" class="comment-date crayons-link crayons-link--secondary fs-s"&gt;
  &lt;time class="date-short-year"&gt;
    Feb 17 '19
  &lt;/time&gt;

&lt;/a&gt;

    &lt;/div&gt;
    &lt;div class="body"&gt;
      

&lt;p&gt;Thanks for the post and the useful links/images. This particular scenario can really be frustrating :)&lt;/p&gt;

&lt;p&gt;Btw have you read a book on git? I found that a good book on git is much more valuable than guides / videos in that scenarios like this one occurred very very, infrequently as a result because of my deeper understanding.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;br&gt;
 on my &lt;a href="https://dev.to/svijaykoushik/stop-tracking-and-start-ignoring-ook"&gt;previous post&lt;/a&gt; &lt;div class="ltag__link"&gt;
&lt;br&gt;
  &lt;a href="/svijaykoushik" class="ltag__link__link"&gt;&lt;br&gt;
    &lt;div class="ltag__link__pic"&gt;
&lt;br&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nV-xey6l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--laNhQL2K--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/45125/a0d7d298-2f45-4dff-a395-be5a620eb794.jpg" alt="svijaykoushik"&gt;&lt;br&gt;
    &lt;/div&gt;
&lt;br&gt;
  &lt;/a&gt;&lt;br&gt;
  &lt;a href="/svijaykoushik/stop-tracking-and-start-ignoring-ook" class="ltag__link__link"&gt;&lt;br&gt;
    &lt;div class="ltag__link__content"&gt;
&lt;br&gt;
      &lt;h2&gt;Stop tracking and start ignoring&lt;/h2&gt;
&lt;br&gt;
      &lt;h3&gt;Vijay Koushik, S. 👨🏽‍💻 ・ Feb 17 '19 ・ 2 min read&lt;/h3&gt;
&lt;br&gt;
      &lt;div class="ltag__link__taglist"&gt;
&lt;br&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;&lt;br&gt;
        &lt;span class="ltag__link__tag"&gt;#untrackfiles&lt;/span&gt;&lt;br&gt;
        &lt;span class="ltag__link__tag"&gt;#removefiles&lt;/span&gt;&lt;br&gt;
        &lt;span class="ltag__link__tag"&gt;#removefolders&lt;/span&gt;&lt;br&gt;
      &lt;/div&gt;
&lt;br&gt;
    &lt;/div&gt;
&lt;br&gt;
  &lt;/a&gt;&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
. Thanks, Ivan 👍🏽. The exercises in the book helped me.

&lt;p&gt;Thanks for your time. :)&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Interface HTMLElement - &lt;a href="http://definitelytyped.org/docs/flipsnap--flipsnap/interfaces/htmlelement.html"&gt;http://definitelytyped.org/docs/flipsnap--flipsnap/interfaces/htmlelement.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Missing basic DOM types in TypeScript project - &lt;a href="https://stackoverflow.com/a/42604094"&gt;https://stackoverflow.com/a/42604094&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Stop tracking and start ignoring: A tip to delete files from a repository and stop tracking them while keeping them locally - &lt;a href="https://svijaykoushik.github.io/blog/2019/02/17/start-ignoring/"&gt;https://svijaykoushik.github.io/blog/2019/02/17/start-ignoring/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TypeScript Tutorial - &lt;a href="https://www.tutorialspoint.com/typescript/."&gt;https://www.tutorialspoint.com/typescript/.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Programming Typescript by Boris Cherny - ISBN 9781492037651&lt;/li&gt;
&lt;li&gt;Advanced types in Typescript - &lt;a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html#union-types"&gt;https://www.typescriptlang.org/docs/handbook/advanced-types.html#union-types&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Type Assertion in Typescript - &lt;a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions"&gt;https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Learn TypeScript in 50 Minutes - &lt;a href="https://youtu.be/WBPrJSw7yQA"&gt;https://youtu.be/WBPrJSw7yQA&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

</description>
      <category>beginners</category>
      <category>typescript</category>
      <category>domtypes</category>
      <category>dommanipulation</category>
    </item>
    <item>
      <title>Harmonizing Colours</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Sun, 03 Mar 2019 09:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/harmonizing-colours-13l7</link>
      <guid>https://forem.com/svijaykoushik/harmonizing-colours-13l7</guid>
      <description>

&lt;p&gt;Hello world!&lt;/p&gt;

&lt;p&gt;I’ll be sharing here an easy method I found on the internet to create a palate of harmonious colours with the HSV colour model. I’ll also explain the terms Hue, saturation and value based on my understanding as a beginner.&lt;/p&gt;

&lt;p&gt;Choosing a good palate of colours was always a herculean task for me as I’m new to web designing. The colours would either look unpleasant or straight up hurt my eyes. Thus, I used online colour picking tools like &lt;a href="https://color.adobe.com/"&gt;Adobe Kuler&lt;/a&gt; and &lt;a href="http://paletton.com/"&gt;Paletton&lt;/a&gt; to create my colour scheme. I decided to stick with choosing from the traditional methods of creating the colour schemes and I refrained from creating a custom palate. But soon my curiosity kicked in and I started reading articles on web designing and app designing to find out how others created harmonious custom colour palates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the HSV/HSB colour model
&lt;/h2&gt;

&lt;p&gt;Most articles I read suggested to use the HSV colour model to create custom colour palates because It allows to choose colours as we perceive in real life. But each article defined these terms in a unique way which was confusing to me and took a bit of time to grab the idea. Among those articles &lt;a href="https://tutsplus.com/authors/tyler-seitz"&gt;Tyler Seitz's&lt;/a&gt; article &lt;a href="https://gamedevelopment.tutsplus.com/articles/picking-a-color-palette-for-your-games-artwork--gamedev-1174"&gt;Picking a Color Palette for Your Game's Artwork&lt;/a&gt; on tuts-plus stood out because of its easily understandable algorithmic approach in creating custom colour palates using the HSV model.&lt;/p&gt;

&lt;p&gt;According to their article, an appealing colour palate can be created by equalizing two of the components in the HSV model. What is HSV model anyway?&lt;br&gt;&lt;br&gt;
According to Wikipedia,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;HSV colour model was created to more closely align with the way human vision perceives colour-making attributes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It has three components viz&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Hue
&lt;/h3&gt;

&lt;p&gt;According to Wikipedia, A hue is&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;the degree to which a stimulus can be described as similar to or different from stimuli that are described as red, green, blue, and yellow&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words, hue is how we identify colours in terms of red, blue, green and yellow. For example, we identify Rose, Hibiscus, Apple and tulip as red even though they don’t exactly have the same colour. And we identify the turquoise gem as greenish-blue colour not green or blue because it appears as a mix of both. This hilarious meme from &lt;a href="https://imgur.com/gallery/DxkYG3s"&gt;imgur&lt;/a&gt; gives a clear picture ;) of how we perceive hues. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eq-9jd5X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/hue_perception.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eq-9jd5X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/hue_perception.jpg" alt="Perception of hues"&gt;&lt;/a&gt;&lt;/p&gt;

How people perceive hues

&lt;p&gt;In HSV model, colours of each hue are arranged in a radial fasion and represented as degrees from 0° to 360°. Where Red has a hue value of 0 ° and going counter clockwise at 120° we have green and further at 240° we have blue. Going further we reach Red at 0°. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d2UBMEgL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/color_wheel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d2UBMEgL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/color_wheel.png" alt="Colour wheel showing hues radially in a circular fashion"&gt;&lt;/a&gt;&lt;/p&gt;

Colour wheel showing hues radially in a circular fashion

&lt;h3&gt;
  
  
  2. Saturation
&lt;/h3&gt;

&lt;p&gt;Saturation is the intensity of the colour with respect to the brightness of the light source. Saturation determines how vivid or how pale a colour appears in a light source. To put this in perspective, imagine how old clothes look faded when compared to new clothes in our wardrobe. The faded colour has less saturation whereas the vivid colours have high saturation. This image of faded jeans is the best representation for different saturations. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TyEv5r2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/faded_denim.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TyEv5r2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/faded_denim.jpeg" alt="Image to represent different saturation of denim blue with constant brightness"&gt;&lt;/a&gt;Image to represent different saturation of denim blue with constant brightness&lt;br&gt;&lt;br&gt;
 Sometimes low saturated colours are called muted colours. In HSV model Saturation takes a value between 0% to 100%. Where 0% saturation makes the colour white and 100% saturation has maximum intensity.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Value
&lt;/h3&gt;

&lt;p&gt;Value indicates how bright or how dark a colour is. When value component of a colour decreases it becomes darker and darker and eventually becomes black with the lowest brightness. On the other hand, increasing the value component makes the colour brighter. With the highest brightness, the colour is considered to be a pure colour when it’s fully saturated. In the real world, birghtness can be visualized as illuminated and shadow regions of objects in everyday life. The illuminated areas have high brightness and the part of objects in the shadows have low brightness. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S6-UGpLR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/shades_demo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S6-UGpLR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/shades_demo.jpg" alt="Image to represent green under different brightness"&gt;&lt;/a&gt;Image to represent green under different brightness&lt;/p&gt;

&lt;h2&gt;
  
  
  Algorithm to create a harmonious colour palate
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note: From this point onwards, I'll be using the term brightness to represent the Value component of HSV model because it's more easy to understand.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I find Tyler Seitz's algorithm easy and efficient in creating a custom colour palate. I’ll just re iterate their algorithm here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To create a great colour palette, you need only follow this rule: &lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IF hues do not equal each other

THEN set saturations to match each other

AND set brightnesses to match each other

ELSE IF saturations do not equal each other

THEN set hues to match each other

AND set brightnesses to match each other

ELSE IF brightnesses do not equal each other

THEN set hues to equal each other

AND set saturations to equal each other
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Shades, Tints and Tones
&lt;/h2&gt;

&lt;p&gt;We can extend this algorithm to create shades, tints and tones of a particular hue&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SHADES

SELECT a Colour

Keep the Hue constant

THEN Change the Brightness in equal intervals

AND Keep the Saturation unchanged.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To create different shades of the colour red, I started with Brightness at 100% and reduced it by 12 equally. This would create 8 shades of the colour. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o8U0eEFZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/shades_of_red.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o8U0eEFZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/shades_of_red.jpg" alt="Different shades of red"&gt;&lt;/a&gt;Different shades of red&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// TINTS

SELECT a Colour

Keep the Hue constant

THEN Change the Saturation in equal intervals

AND Keep the Brightness unchanged.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Similarly, to create different tints, I start with 100% saturation and bring the it down by 12 evenly to get 8 separate tints. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bzI9e5p1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/tints_of_red.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bzI9e5p1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/tints_of_red.jpg" alt="Different tints of red"&gt;&lt;/a&gt;Different tints of red&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// TONES

SELECT a Colour

Keep the Hue constant

THEN Change the Brightness in equal intervals

AND Change the Saturation with the same interval.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And to create multiple tones, I would again start with 100% brightness and 100% saturation and reduce them both in counts of 12 to obtain 8 different tones. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a-X5aqAc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/tones_of_red.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a-X5aqAc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/tones_of_red.jpg" alt="Different tones of red"&gt;&lt;/a&gt;Different tones of red&lt;/p&gt;

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

&lt;p&gt;I used this algorithm to create a palate and it’s not bad for a first attempt. And This is how I implemented it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NAqPLFvg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/my_result.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NAqPLFvg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_03_03/my_result.png" alt="My result after after following the steps to create a color palate"&gt;&lt;/a&gt;My result after after following the steps to create a color palate&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Color Theory for Designers: How To Create Your Own Color Schemes - &lt;a href="https://www.smashingmagazine.com/2010/02/color-theory-for-designer-part-3-creating-your-own-color-palettes/"&gt;https://www.smashingmagazine.com/2010/02/color-theory-for-designer-part-3-creating-your-own-color-palettes/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Picking a Color Palette for Your Game’s Artwork - &lt;a href="https://gamedevelopment.tutsplus.com/articles/picking-a-color-palette-for-your-games-artwork%E2%80%93gamedev-1174"&gt;https://gamedevelopment.tutsplus.com/articles/picking-a-color-palette-for-your-games-artwork–gamedev-1174&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Color: HSB and tint-tone-shade - &lt;a href="https://getpocket.com/a/read/1609347779"&gt;https://getpocket.com/a/read/1609347779&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;HSV color model - &lt;a href="https://en.wikipedia.org/wiki/HSL%5C_and%5C_HSV"&gt;https://en.wikipedia.org/wiki/HSL\_and\_HSV&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;


</description>
      <category>beginners</category>
      <category>webdesign</category>
      <category>colourpalate</category>
    </item>
    <item>
      <title>Stop tracking and start ignoring</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Mon, 18 Feb 2019 09:00:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/stop-tracking-and-start-ignoring-ook</link>
      <guid>https://forem.com/svijaykoushik/stop-tracking-and-start-ignoring-ook</guid>
      <description>

&lt;p&gt;Hello world,&lt;/p&gt;

&lt;p&gt;I’ve been playing around with GitHub &amp;amp; Git over the past few months and most of the time I accidentally commit and push files that are totally unrelated to the project. Usually they are the environment files like &lt;em&gt;node_modules&lt;/em&gt; &amp;amp; &lt;em&gt;build&lt;/em&gt; directories and &lt;em&gt;package.json&lt;/em&gt; when using node.js as I use Gulp to minify css &amp;amp; JS and files like &lt;em&gt;_site&lt;/em&gt; folder and &lt;em&gt;Gemfile.lock&lt;/em&gt; when I use Jekyll for my blog.&lt;/p&gt;

&lt;p&gt;The reason for this problem? I forget to add the &lt;em&gt;.gitignore&lt;/em&gt; file to my repository. The &lt;em&gt;.gitignore&lt;/em&gt; file contains all the ignore rules (usually names of files and folders to be ignored) for the project. But there is a catch. The &lt;em&gt;.gitignore&lt;/em&gt; file will tell Git to ignore the existence of only those files that haven’t been pushed. Since I have already pushed the files, adding them to the ignore rule won't work. Git will keep tracking the changes to those files and nag me to commit those changes.&lt;/p&gt;

&lt;p&gt;I could delete these files and push the deletions to the repo but, they’re going to be recreated every time I build the project. So, that doesn’t work. A quick search on the internet gave me the exact solution I needed. There is a way to remove these files from the repo and keep them locally. By executing the following command in a CLI like &lt;strong&gt;git bash&lt;/strong&gt; or &lt;strong&gt;cmd&lt;/strong&gt; I deleted the files from the repo without removing them from my local file system.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    git rm --cached &amp;lt;file name&amp;gt;
    E.g. git rm --cached package.json

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



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nqeXZKLE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/rm_cached_file.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nqeXZKLE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/rm_cached_file.jpg" alt="Break down of remove a file only from repository command in git"&gt;&lt;/a&gt;&lt;em&gt;A break down of the command to remove a file only from the repository&lt;/em&gt;  &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    git rm –r --cached &amp;lt;directory name&amp;gt;
    E.g. git rm –r --cached _sites

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



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Oow3VBP5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/rm_cached_folder.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Oow3VBP5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/rm_cached_folder.jpg" alt="Break down of remove a folder and it's contents only from repository command in git"&gt;&lt;/a&gt;&lt;em&gt;A break down of the command to remove a folder and it's contents only from the repository&lt;/em&gt;&lt;br&gt;&lt;br&gt;
The &lt;code&gt;--cached&lt;/code&gt; flag removes the files from the repository and leaves the local copies undisturbed. And the &lt;code&gt;–r&lt;/code&gt; flag recursively removes the files inside the directory specified.&lt;/p&gt;

&lt;p&gt;Now that I removed the files from the repo, Git thinks that the local copies of the deleted files are something new I added to the repo. So adding these file names to the &lt;em&gt;.gitignore&lt;/em&gt; file will tell git to ignore these files and they won’t be pushed again.&lt;/p&gt;

&lt;p&gt;Since this accident happens to me frequently, I decided to post this here so I wouldn't forget to add the ignore rules to the repo. Even if I do forget, I know where to look for the solution.&lt;/p&gt;

&lt;p&gt;To make things more simple I found a site &lt;a href="https://gitignore.io"&gt;gitignore.io&lt;/a&gt; that generates &lt;em&gt;.gitignore&lt;/em&gt; file based on the Operating systems, IDEs and programming languages that I provide in an all in one text box. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8yPAv2jS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/gitignoredoti_shot.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8yPAv2jS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://svijaykoushik.github.io/blog/img/2019_02_16/gitignoredoti_shot.jpg" alt="Screenshot of the site gitignore.io"&gt;&lt;/a&gt;&lt;em&gt;A screenshot of gitignore.io's homepage&lt;/em&gt;&lt;/p&gt;


</description>
      <category>git</category>
      <category>untrackfiles</category>
      <category>removefiles</category>
      <category>removefolders</category>
    </item>
    <item>
      <title>Creating Bounding box for different code generated shapes</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Mon, 22 Oct 2018 16:15:48 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/creating-bounding-box-for-different-code-generated-shapes-122b</link>
      <guid>https://forem.com/svijaykoushik/creating-bounding-box-for-different-code-generated-shapes-122b</guid>
      <description>

&lt;p&gt;Hello word,&lt;br&gt;
I've been learning html5 game development for a few months and now I'm creating a &lt;em&gt;breakout game&lt;/em&gt; in &lt;strong&gt;vanilla JS&lt;/strong&gt; without any plugins for physics. And I'm also using assets generated through code. I'm doing this to learn basic game physics and to prove to myself that I can develop a game without 3rd party plugins or framework.&lt;/p&gt;

&lt;p&gt;I'm using axis aligned bounding box (AABB) for collision detection. It was easy to implement it for the bricks, the paddle and the ball. Next, I wanted to add powerups. I thought about using shapes other than rectangles and circles for power drops like &lt;em&gt;stars&lt;/em&gt; or &lt;em&gt;clouds&lt;/em&gt; for powerups and &lt;em&gt;hearts&lt;/em&gt; for extra lives. I managed to find the code to draw these shapes but, I can't figure out how to create a bounding box for these odd shapes. &lt;/p&gt;

&lt;p&gt;I need guidance for programmatically creating bounding boxes for different shapes generated via code. I hope I'm clear with my question 🙂🤞🏽.&lt;/p&gt;


</description>
      <category>help</category>
      <category>gamedev</category>
      <category>javascript</category>
      <category>aabbcollision</category>
    </item>
    <item>
      <title>Why I use Bing</title>
      <dc:creator>Vijay Koushik, S. 👨🏽‍💻</dc:creator>
      <pubDate>Sun, 02 Sep 2018 22:45:00 +0000</pubDate>
      <link>https://forem.com/svijaykoushik/why-i-use-bing-53cc</link>
      <guid>https://forem.com/svijaykoushik/why-i-use-bing-53cc</guid>
      <description>&lt;p&gt;Hello world! It's been a long time since I posted an article since I couldn't find time. So here's a quick post originally posted on my &lt;a href="https://svijaykoushik.github.io/blog/2018/09/02/why-i-use-bing/" rel="noopener noreferrer"&gt;blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After giving a try to Bing I made a switch to it as my default search engine a couple of years ago. Though I made a switch, it is not 100% complete. I occasionally use Google from time to time. Without further ado here are 5 reasons I made a switch to Bing.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Homepage Background
&lt;/h2&gt;

&lt;p&gt;This is the main reason I switched to Bing. On the early days of trying Bing I was working for a company where I used to start the day by opening my mail box on my browser. Bing, greets me with Gorgeous and colourful backgrounds (dubbed Image of the day) every single day. It may be a cute animal, a serene scenery, an elegant culture or marvelous achievements that we humans made. Sometimes the backgrounds may be short clips or even 360deg pictures. The cool thing is that it allows me to download the background if I like it so much and make it my wallpaper on my device. Making my homepage Bing was and is the favorite way to start my day. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fhome_background.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fhome_background.jpg" alt="Homepage Background"&gt;&lt;/a&gt;&lt;em&gt;A typical Bing homepage with an alluring background&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Personalized Image feed
&lt;/h2&gt;

&lt;p&gt;Speaking of colourful images, Bing Image search allows me to make a personalized list of favorites (Broad topics like Animals to specific topics like cute cats) and show them as a feed with updated images on every visit. If the home page doesn’t satisfy me, then this will. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fimage_feed.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fimage_feed.jpg" alt="Personalized Image feed"&gt;&lt;/a&gt;&lt;em&gt;My Personalized Image feed&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. More Image search
&lt;/h2&gt;

&lt;p&gt;Other than an image feed the image search has a few neat features that often help me. Among them the following two are my favorites&lt;/p&gt;

&lt;h3&gt;
  
  
  a.GIF search
&lt;/h3&gt;

&lt;p&gt;Posting GIF comments on social media is very fun. When I search for gifs I don’t have to click on every result to see the animation in action, instead I just hover over the results to see the preview. If I am on mobile the gif just auto plays! Given that enough time is given to load the gifs in both the cases. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fgif_search.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fgif_search.gif" alt="GIF search"&gt;&lt;/a&gt;&lt;em&gt;Hover to preview GIF.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  b.Search Within
&lt;/h3&gt;

&lt;p&gt;The search engine also has the feature to search within the image i.e. a part of the image. Whenever I need to find similar pictures of a part of a photo from a selfie or other pictures I highlight the area to be searched and get the results. The downside is, the accuracy of the results depend on the quality of the highlighted part of the image. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fimage_within.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fimage_within.gif" alt="Search Within"&gt;&lt;/a&gt;&lt;em&gt;Searching a part of an Image.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Video Preview
&lt;/h2&gt;

&lt;p&gt;Another Important feature I like is the video preview. Often I search for solutions for OS or software problems, or video songs. Rather than starting a video, I hover over the result to get a short preview. It is to be noted that the preview option, if disabled by the publisher of the video will not work. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fvideo_search.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fvideo_search.gif" alt="Video Preview"&gt;&lt;/a&gt;&lt;em&gt;Previewing videos on Bing.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Code Samples
&lt;/h2&gt;

&lt;p&gt;This awesome feature is specific to programming. Since I like to code I always search for solutions for my problems on the web. In Bing, I get code samples among the results (Obviously from stack overflow). If it’s a generic problem like bubble sort I get an editable &amp;amp; executable code samples. Getting what I need on the results page helps me save time. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fcode_sample.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsvijaykoushik.github.io%2Fblog%2Fimg%2F2018_09_02%2Fcode_sample.gif" alt="Code Samples"&gt;&lt;/a&gt;&lt;em&gt;Executing a code sample of bubble sort method of sorting a list.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As said in the beginning, I did not completely switch to Bing. It’s not perfect; I tend to use Google If I’m not satisfied with the results. These reasons stated here are based on my personal preferences and my perspective of usability. One advantage of using two search engines is that One can find Interesting information (trivial or important) on one site that the other fails to display. And I apologize for bad quality of Images. I had to compress them to save load time.&lt;/p&gt;

&lt;p&gt;Header Photo by Steve Johnson from &lt;a href="https://www.pexels.com/photo/person-s-index-finger-977246/" rel="noopener noreferrer"&gt;Pexels&lt;/a&gt;&lt;/p&gt;

</description>
      <category>top5</category>
    </item>
  </channel>
</rss>
