<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[All about programming and building fullstack web application and mobile application. Blogs by Aashish Panthi from Nepal]]></title><description><![CDATA[I am a full stack developer and here I share my experiences and also share some guides or tutorials for doing certain things related to web development with Javascript and topics.]]></description><link>https://blog.aashish-panthi.com.np</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1662002711009/x33eB9pyo.png</url><title>All about programming and building fullstack web application and mobile application. Blogs by Aashish Panthi from Nepal</title><link>https://blog.aashish-panthi.com.np</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 00:39:24 GMT</lastBuildDate><atom:link href="https://blog.aashish-panthi.com.np/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting Up the p5.js Web Editor for Local Development: A Beginner-Friendly Guide]]></title><description><![CDATA[The p5.js Web Editor is an intuitive, browser-based platform for creative coding with JavaScript. It allows artists, designers, and educators to dive into coding visually, without needing to set up any development environment. But what if you're a de...]]></description><link>https://blog.aashish-panthi.com.np/set-up-the-p5js-web-editor-locally</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/set-up-the-p5js-web-editor-locally</guid><category><![CDATA[p5.js]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Wed, 28 May 2025 18:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1748885433136/7405135d-55f4-4e6c-b8e0-9d870b37107e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The p5.js Web Editor is an intuitive, browser-based platform for creative coding with JavaScript. It allows artists, designers, and educators to dive into coding visually, without needing to set up any development environment. But what if you're a developer who wants to run the editor locally, contribute to its development, or customize it for your creative platform?</p>
<p>In this blog, we'll walk through the <strong>entire process of setting up the p5.js Web Editor locally</strong>, breaking it down into digestible steps—each explained with the “why,” not just the “how.” Whether you're contributing to open source for the first time or just want to tinker with a cool tool, this guide is for you.</p>
<p>If you want the official guide, you can visit this link: <a target="_blank" href="https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/README.md">https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/README.md</a>. If you have a problem with this, follow this guide.</p>
<hr />
<h2 id="heading-why-set-it-up-locally">Why Set It Up Locally?</h2>
<p>Running the p5.js Web Editor locally can benefit you in many ways:</p>
<ul>
<li><p>✅ Customize or extend its features</p>
</li>
<li><p>✅ Contribute back to the open-source project</p>
</li>
<li><p>✅ Debug and explore the code (understand how real software is written)</p>
</li>
<li><p>✅ Work offline or in educational settings with limited (unstable) internet access</p>
</li>
</ul>
<p>Let’s get started!</p>
<hr />
<h2 id="heading-step-1-prerequisites-tools-you-need">Step 1: Prerequisites – Tools You Need</h2>
<p>Before starting, please make sure you’ve a few tools installed on your system. These are the foundational pieces every JavaScript developer should be familiar with.</p>
<h3 id="heading-1-nodejs-and-npm">1. Node.js and npm</h3>
<p>The editor is a Node.js application, so make sure you have:</p>
<ul>
<li><p><strong>Node.js v16.14.2</strong></p>
</li>
<li><p><strong>npm v8.5.0</strong></p>
</li>
</ul>
<p>To check the versions of node, use this command:</p>
<pre><code class="lang-bash">node -v
</code></pre>
<p>To check the version of npm, use this command:</p>
<pre><code class="lang-bash">npm -v
</code></pre>
<p>If you see a different version than the versions mentioned above, I recommend that you change to the mentioned version. There are multiple ways to do that. If you’re on linux, you might like this article:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries">https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries</a></div>
<p> </p>
<p>Or, take <a target="_blank" href="https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4">this article</a> and video attached as a guide.</p>
<p>However, I <strong>highly recommend using</strong> <code>nvm</code> (Node Version Manager) so you can manage multiple Node versions with ease.</p>
<p>To install <code>nvm</code>, open your terminal and run:</p>
<pre><code class="lang-bash">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
</code></pre>
<p>After installing <code>nvm</code>, restart your terminal and then:</p>
<pre><code class="lang-bash">nvm install 16.14.2
nvm use 16.14.2
</code></pre>
<p>Verify:</p>
<pre><code class="lang-bash">node -v    <span class="hljs-comment"># Should show v16.14.2</span>
npm -v     <span class="hljs-comment"># Should show v8.5.0</span>
</code></pre>
<hr />
<h2 id="heading-step-2-fork-and-clone-the-repository">Step 2: Fork and Clone the Repository</h2>
<p>We’ll work with a fork of the original p5.js Web Editor repository so you can push your changes later if you want.</p>
<ol>
<li><p>Go to <a target="_blank" href="https://github.com/processing/p5.js-web-editor">https://github.com/processing/p5.js-web-editor</a></p>
</li>
<li><p>Click the <strong>Fork</strong> button (top right)</p>
</li>
<li><p>After forking, clone your copy to your machine:</p>
</li>
</ol>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/YOUR_USERNAME/p5.js-web-editor.git
</code></pre>
<blockquote>
<p>Replace <code>YOUR_USERNAME</code> with your github account username that you used to fork the repository.</p>
</blockquote>
<p>After you clone the repository on your local system, let’s move to the folder inside:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> p5.js-web-editor
</code></pre>
<p>Now, to view the code or to perform any operations on it, we need to open it up the code in an editor. I prefer VS Code, which is free to use. If you don’t have download it from <a target="_blank" href="https://code.visualstudio.com/download">here</a>. However, if you have then you can use the following command on your terminal to open up the project inside the code editor.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748886609375/93224c3f-3d2e-4310-b03b-085176ffe27b.png" alt class="image--center mx-auto" /></p>
<p>Once you press Enter, you should see something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748886854911/31d28402-e0a5-48c7-b2c1-64c4ac2ce13f.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-step-3-understanding-the-basic-project-structure">Step 3: Understanding the basic Project Structure</h2>
<p>Here’s a quick overview to make you feel at home in the codebase:</p>
<ul>
<li><p><code>server/</code>: Express backend server for authentication, file handling, etc.</p>
</li>
<li><p><code>client/</code>: React-based frontend for the web editor</p>
</li>
<li><p><code>.env</code>: Environment variables for sensitive settings</p>
</li>
<li><p><code>package.json</code>: Declares dependencies, scripts, and metadata</p>
</li>
</ul>
<hr />
<h2 id="heading-step-4-install-dependencies">Step 4: Install Dependencies</h2>
<p>If you try to start the server, you’ll receive an error message. That’s because the editor uses many libraries and dependencies. Installing them is straightforward:</p>
<pre><code class="lang-bash">npm install
</code></pre>
<p>This reads the <code>package.json</code> file and downloads all required modules into the <code>node_modules</code> directory.</p>
<p>If you run into issues, try cleaning the cache and reinstalling:</p>
<pre><code class="lang-bash">npm cache clean --force
rm -rf node_modules
npm install
</code></pre>
<p>Now that we have all the required packages, we can try starting the server. If you look at the <code>package.json</code> file, then you’ll find the start command:</p>
<pre><code class="lang-bash">npm start
</code></pre>
<p>However, this will give you some error. At the end of the message, you’ll find this: <code>[nodemon] app crashed - waiting for file changes before starting...</code> and on top it says: <code>Error: Parameter "key" is required</code>. To resolve this problem, you need to follow the following steps.</p>
<hr />
<h2 id="heading-step-5-setting-up-the-database-mongodb">Step 5: Setting Up the Database (MongoDB)</h2>
<p>The Web Editor stores sketches and user information in a <strong>MongoDB</strong> database.</p>
<h3 id="heading-option-1-install-mongodb-locally">Option 1: Install MongoDB Locally</h3>
<p>Follow the official guide for your OS:<br />👉 <a target="_blank" href="https://docs.mongodb.com/manual/installation/">https://docs.mongodb.com/manual/installation/</a></p>
<p>Once installed, start the service:</p>
<pre><code class="lang-bash">mongod --dbpath /your/custom/path
</code></pre>
<p>Or, if you’ve a Mac, then you can install <a target="_blank" href="https://brew.sh/">Homebrew</a> to install any packages. If you don’t have Homebrew, paste the following command on your terminal to install it:</p>
<pre><code class="lang-bash">/bin/bash -c <span class="hljs-string">"<span class="hljs-subst">$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)</span>"</span>
</code></pre>
<p>Or, you can install the homebrew with the new .pkg installer. The instructions are <a target="_blank" href="https://brew.sh/#:~:text=If%20you%27re%20on%20macOS%2C%20try%20our%20new%20.pkg%20installer.">here</a>.</p>
<p>Here is how you can install and run MongoDB using brew:</p>
<pre><code class="lang-bash">brew tap mongodb/brew
</code></pre>
<p>Then</p>
<pre><code class="lang-bash">brew install mongodb-community
</code></pre>
<p>Finally, start the server with</p>
<pre><code class="lang-bash">brew services start mongodb-community
</code></pre>
<blockquote>
<p>🧪 Tip: You can use <a target="_blank" href="https://www.mongodb.com/products/compass">MongoDB Compass</a> to visually inspect your database and collections.</p>
</blockquote>
<hr />
<h2 id="heading-step-6-configure-environment-variables">Step 6: Configure Environment Variables</h2>
<p>The project uses a <code>.env</code> file to store settings like database connections and GitHub OAuth credentials.</p>
<p>You don’t have to configure everything to run the app locally, but you still need a <code>.env</code> file.</p>
<pre><code class="lang-bash">cp .env.example .env
</code></pre>
<p>The above command makes a copy of <code>.env.example</code> file into <code>.env</code> file. You can open <code>.env</code> in a text editor and make changes later if you need GitHub login or production features.</p>
<hr />
<h2 id="heading-step-7-launching-the-app">Step 7: Launching the App</h2>
<p>With everything set, you can now start the server:</p>
<pre><code class="lang-bash">npm start
</code></pre>
<p>By default, the app will be available at:</p>
<p>👉 <a target="_blank" href="http://localhost:8000">http://localhost:8000</a></p>
<p>You should see a fully working p5.js Web Editor interface!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748888450672/d4f0f7e9-a211-4ab9-bf79-f1d329e35e90.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-optional-resetting-the-local-database">Optional: Resetting the Local Database</h2>
<p>During development, you might want to reset your database:</p>
<pre><code class="lang-bash">npm run reset-local-db
</code></pre>
<p>This clears all data and resets the state. Very handy for testing new features!</p>
<hr />
<h2 id="heading-common-issues-and-fixes">Common Issues and Fixes</h2>
<h3 id="heading-error-permission-denied-on-npm-install">❌ Error: Permission Denied on <code>npm install</code></h3>
<p>✅ Try:</p>
<pre><code class="lang-bash">sudo chown -R <span class="hljs-variable">$USER</span>:<span class="hljs-variable">$GROUP</span> ~/.npm
</code></pre>
<h3 id="heading-mongodb-not-connecting">❌ MongoDB Not Connecting?</h3>
<p>✅ Check if MongoDB is running:</p>
<pre><code class="lang-bash">ps aux | grep mongod
</code></pre>
<p>✅ Or try restarting:</p>
<pre><code class="lang-bash">brew services restart mongodb-community
</code></pre>
<h3 id="heading-github-login-doesnt-work">❌ GitHub Login Doesn’t Work</h3>
<p>✅ You need to register a GitHub OAuth App and add your <code>CLIENT_ID</code> and <code>CLIENT_SECRET</code> to your <code>.env</code>.</p>
<hr />
<h2 id="heading-contributing-to-the-project">Contributing to the Project</h2>
<p>If you’re planning to contribute, here are a few bonus tips:</p>
<ul>
<li><p>Follow the code style and naming conventions in the existing codebase.</p>
</li>
<li><p>Open pull requests only after thoroughly testing your changes.</p>
</li>
<li><p>Be respectful and follow the <a target="_blank" href="https://editor.p5js.org/code-of-conduct">code of conduct</a>.</p>
</li>
</ul>
<hr />
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>The p5.js Web Editor is more than just a playground—it's an ecosystem that empowers artists, students, and coders to express themselves through code. You gain full access to its engine room by running it locally, and play with it.</p>
<p>💬 Got stuck or found a bug in this guide? Feel free to leave a comment or contact me. If you find a bug in the p5.js web editor, <a target="_blank" href="https://github.com/processing/p5.js-web-editor/issues">open an issue on GitHub</a>.</p>
<p>Happy hacking! 💻✨</p>
]]></content:encoded></item><item><title><![CDATA[SVG path animation in Nextjs using GSAP]]></title><description><![CDATA[Before starting out, let me quickly share what we're building today.
Open codesandbox.io or visit gsap-svg-path-animation.netlify.app.
Seems interesting, let's start.
Introduction
You might have visited some websites where when you scroll, things mov...]]></description><link>https://blog.aashish-panthi.com.np/svg-path-animation-in-nextjs-using-gsap</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/svg-path-animation-in-nextjs-using-gsap</guid><category><![CDATA[Next.js]]></category><category><![CDATA[GSAP]]></category><category><![CDATA[animation]]></category><category><![CDATA[scroll animation]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Tue, 28 May 2024 03:36:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1716867233378/d0eb6d47-a98b-457c-865a-793946ff4f30.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Before starting out, let me quickly share what we're building today.</p>
<p>Open <a target="_blank" href="https://codesandbox.io/p/devbox/svg-path-animation-4d2k2v">codesandbox.io</a> or visit <a target="_blank" href="https://gsap-svg-path-animation.netlify.app/"><strong>gsap-svg-path-animation.netlify.app</strong></a><strong>.</strong></p>
<p>Seems interesting, let's start.</p>
<h2 id="heading-introduction">Introduction</h2>
<p>You might have visited some websites where when you scroll, things move; some elements move up, some sideways, and sometimes move down also. The elements follow a path when they move and often the path they follow is drawn using &lt;path&gt; element in SVG.</p>
<h3 id="heading-brief-overview-of-svg-animation">Brief overview of SVG animation</h3>
<p>Unlike raster images, the SVGs don't lose their quality on zooming because SVGs are just a bunch of coordinates to make mathematical polygons. Also, unlike raster images, SVGs can be animated. We can change color, change size, change shape, and do more cooler stuff. That's all about the SVG animation.</p>
<p>Now let me explain what an SVG path animation means. So, if you've worked with SVGs before, there are different shapes that you can draw. There are ellipses, lines, polygons, rectangles, circles, and many others. You can find the complete list <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Basic_Shapes">here</a>. In particular, there is something called <code>path</code> that is used to draw lines, irregular lines; as you do with your hands. Unlike hand-drawn lines, the lines drawn with path elements can be animated. The path is used to guide some elements to move in a specific direction, basically a path and sometimes used to animate the line itself.</p>
<h3 id="heading-introduction-to-nextjs">Introduction to Next.js</h3>
<p>I assume you know Next.js. If you don't that's ok. You'll get almost everything out of this article. So, for those who don't know what Next.js is, let me quickly share about the most loved framework by lazy developers (I don't know if it's most loved or not; I love it).</p>
<p>Next.js is a javascript framework, like React.js but better. Next. js supports Server-Side Rendering (SSR), whereas React. js supports client-side rendering. Doesn't sound like a big deal but it is. SSR improves the application performance and speed and that's the reason I love Next.js.</p>
<h3 id="heading-introduction-to-gsap-greensock-animation-platform">Introduction to GSAP (GreenSock Animation Platform)</h3>
<p>Unlike Next.js, I don't assume you know GSAP. So, GSAP which stands for GreenSock Animation Platform is another javascript framework <em>(yes, there are millions of javascript frameworks)</em> that is used to animate elements on websites. Open their website (<a target="_blank" href="https://gsap.com/">gsap.com</a>) to explore the type of animations you can make using GSAP.</p>
<h3 id="heading-purpose-and-scope-of-the-article">Purpose and scope of the article</h3>
<p>The article's purpose is to help you make GSAP animations in your Next.js project. It's the same for React also. In particular, we'll be looking at SVG path animation on scroll. I assume you saw the demo above.</p>
<h2 id="heading-setting-up-the-development-environment">Setting Up the Development Environment</h2>
<p>Now let's move on to the actually stop so we are going to set up our development environment and we will be using the npm package manager and create our next application, and use the GSAP library.</p>
<h3 id="heading-installing-nodejs-and-npm">Installing Node.js and npm</h3>
<p>I assume you already have nodejs installed. If you don't then head over to not <a target="_blank" href="https://nodejs.org">nodejs.org</a> and download the latest version. Remember I want you to download the long-term support (LTS) version. If you're on Linux then this:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries">https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries</a></div>
<p> </p>
<p>or this: <a target="_blank" href="https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4">https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4</a> article will help you.</p>
<p>To confirm you've installed node.js, run this command on your command prompt or terminal:</p>
<pre><code class="lang-bash">node --version
</code></pre>
<p>And you should be seeing some numbers on the screen that represent the version of node.js installed on your machine. It looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716813916760/bc8e9831-ccab-43f6-b669-44408f7724f0.png" alt class="image--center mx-auto" /></p>
<p>Now that you have installed the node.js, you need to take for the npm. In most of the cases, the npm gets installed automatically but if it does not, you can install it manually. So let's check if the npm is installed or not. Run the following command on your terminal:</p>
<pre><code class="lang-bash">npm --version
</code></pre>
<p>And if the npm is installed then, you'll see the version like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716814093008/c0e1920f-bcbc-4b48-847c-018de405ca8c.png" alt class="image--center mx-auto" /></p>
<p>The basic setup is complete. Now let's move on to nitty-gritty.</p>
<h3 id="heading-setting-up-a-new-nextjs-project">Setting up a new Next.js project</h3>
<p>If you would love to read the official documentation on installing nextjs then <a target="_blank" href="https://nextjs.org/docs/pages/api-reference/create-next-app"><em>here it is</em></a><em>.</em> Otherwise, I'm here to help.</p>
<p>Now, to install next.js we need to run this command on our terminal:</p>
<pre><code class="lang-bash">npx create-next-app@latest
</code></pre>
<p>Now, it'll ask a few questions. These questions are important and carefully answer them.</p>
<ul>
<li><p>First, you'll be asked to name the project. Please name it.</p>
</li>
<li><p>You'll be asked if you want to use typescript or not. I prefer typescript but it's your call. (In the rest of the article, we'll be using typescript but I'll provide the javascript code at the end).</p>
</li>
<li><p>I like to use Eslint.</p>
</li>
<li><p>Also, I'll be using tailwind CSS. If you want to sit and write your custom CSS then you've a right to opt out.</p>
</li>
<li><p>Next, it will ask if you'd like to have a <code>src</code> directory or not. It's more of a personal preference and I would say yes here.</p>
</li>
<li><p>And please use the app router. Please...</p>
</li>
<li><p>The final question asks you about the default import alias. We don't want to do that so select no.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716814965625/69bd4c23-bbdc-49d6-8dd5-5c0c5cd4c897.png" alt="Nextjs project configuration by Aashish Panthi" class="image--center mx-auto" /></p>
<p>So, after a few seconds, your project will be ready and I would love if you open the project on some code editor. I'll be using <a target="_blank" href="https://code.visualstudio.com/">Visual Studio Code</a>.</p>
<p>Go inside of the project and open the terminal. Run the start command to start the project:</p>
<pre><code class="lang-bash">npm run dev
</code></pre>
<p>And visit <a target="_blank" href="http://localhost:3000/">http://localhost:3000/</a> to see your project running.</p>
<h3 id="heading-installing-gsap">Installing GSAP</h3>
<p>Let's quickly install the GSAP packages also. Use the following command to install <code>gsap</code> and <code>@gsap/react</code> packages:</p>
<pre><code class="lang-bash">npm i @gsap/react gsap
</code></pre>
<p>That's all. First, let's have our SVG ready and then we'll animate. Alright?</p>
<h2 id="heading-creating-svg-graphics">Creating SVG Graphics</h2>
<p>I assume you already have your SVG element ready. If you have it on your figma, export it as SVG. If you don't have you can make one.</p>
<h3 id="heading-designing-svg-graphics">Designing SVG graphics</h3>
<p>I quickly made this shape in Figma using pen tool. It is basically the path over which we'll be moving stuff on the scroll event. I still don't know what I'll be moving.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716816253920/aa2c523a-a8a9-470a-b270-0b948e0799b8.png" alt class="image--center mx-auto" /></p>
<p>To export your SVG from Figma, select the shape you want to export. If you have more than one shape, select the shapes and group them then export them as SVG. You'll see the export option at the right end of the screen:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716816470277/c0bf3b60-c10c-4b77-93a1-8a0b775c15e9.png" alt class="image--center mx-auto" /></p>
<p>Well, if you would like to use mine then here is the SVG code:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">svg</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"462"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"829"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 0 462 829"</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"none"</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M36.4996 4L429.5 238C449.666 250 479 284.9 435 328.5C391 372.1 151 480.333 36.4996 529C12.1662 545.167 -21.9004 587.7 36.4996 628.5C94.8996 669.3 326.5 776.167 435 824.5"</span> <span class="hljs-attr">stroke</span>=<span class="hljs-string">"#0000FF"</span> <span class="hljs-attr">stroke-width</span>=<span class="hljs-string">"8"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span>
</code></pre>
<p>Ok, that's the path and let's move a card along that path. Sound great? I've made a car. I'm not a designer. Please don't judge me:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716818695442/ac55b826-51e8-4aa2-a858-2ae155ddaf00.png" alt class="image--center mx-auto" /></p>
<p>I've grouped the two items and exported them as SVG. If you want the code, here it is:</p>
<pre><code class="lang-xml">
<span class="hljs-tag">&lt;<span class="hljs-name">svg</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"462"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"844"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 0 462 844"</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"none"</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5"</span> <span class="hljs-attr">stroke</span>=<span class="hljs-string">"#0000FF"</span> <span class="hljs-attr">stroke-width</span>=<span class="hljs-string">"8"</span>/&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M37.7316 37.3941L46.4471 37.0985C46.7214 37.0872 46.9392 36.9896 47.1001 36.8317L60.2671 45.3825C62.7497 46.9947 65.6719 46.8955 66.7971 45.163L73.9314 34.1771C75.0579 32.4425 73.9598 29.7326 71.4773 28.1204L58.3102 19.5696C58.3877 19.3605 58.3896 19.1198 58.2883 18.8645L55.0122 10.7844C54.706 10.0288 53.6614 9.44663 52.673 9.47815C51.6862 9.51362 51.134 10.152 51.4373 10.9057L53.7501 16.6082L41.4135 8.59676C38.9339 6.98646 36.0087 7.08368 34.8822 8.81829L27.7479 19.8042C26.6228 21.5367 27.7237 24.2485 30.2034 25.8588L42.5399 33.8703L36.387 34.081C35.5765 34.1085 35.2193 34.8705 35.5882 35.7864C35.9614 36.7022 36.9182 37.4197 37.7316 37.3941ZM56.9649 23.0482L56.3711 23.9626L46.2266 17.3747L46.8204 16.4603L56.9649 23.0482ZM40.0447 12.0601L43.6442 15.6977L37.5977 25.0085L32.8092 23.2018L40.0447 12.0601ZM39.5849 27.602L40.1801 26.6855L50.3246 33.2734L49.7294 34.1899L39.5849 27.602ZM52.8688 34.9256L58.9153 25.6149L63.7025 27.4236L56.467 38.5653L52.8688 34.9256Z"</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"#E52A2D"</span>/&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span>
</code></pre>
<h3 id="heading-importing-svg-files-into-the-nextjs-project">Importing SVG files into the Next.js project</h3>
<p>No, we are not going to import the SVG file. Rather we will have SVG inside our JSX file with other react neety-greety.</p>
<p>Let's create a separate component for the Animation thing and we'll import it inside of our page.tsx file. And the root <code>page.tsx</code> file should look like this:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> PathAnimation <span class="hljs-keyword">from</span> <span class="hljs-string">"@/components/PathAnimation"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Home</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">main</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"flex-col min-h-screen w-full dark:text-white"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"h-screen w-full flex flex-col items-center justify-center"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-[#432826] text-[24px] leading-[36px] font-[400] text-center dark:text-white"</span>&gt;</span>
          SVG Path Animation
        <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-[16px] leading-[27px] text-[#432826] font-[400] text-center dark:text-white"</span>&gt;</span>
          This is a simple animation of a bee following a path using GSAP
          MotionPath plugin.
        <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

      <span class="hljs-tag">&lt;<span class="hljs-name">PathAnimation</span> /&gt;</span>

      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"h-screen w-full flex flex-col items-center justify-center"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-[#432826] text-[24px] leading-[36px] font-[400] dark:text-white"</span>&gt;</span>
          You saw that?
        <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-[16px] leading-[27px] text-[#432826] font-[400] dark:text-white"</span>&gt;</span>
          The bee is following the path. Isn't that cool?
        <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span></span>
  );
}
</code></pre>
<p>And let's have our <code>PathAnimation.jsx</code> file separately (create a components folder and place it there). The component looks like this:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">PathAnimation</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">section</span>
      <span class="hljs-attr">className</span>=<span class="hljs-string">"py-16 px-4 md:px-2 bg-secondary w-full"</span>
    &gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">{</span>`<span class="hljs-attr">max-w-</span>[<span class="hljs-attr">1250px</span>] <span class="hljs-attr">w-full</span> <span class="hljs-attr">mx-auto</span> <span class="hljs-attr">relative</span> <span class="hljs-attr">mt-16</span> <span class="hljs-attr">mb-20</span>`}&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">svg</span>
          <span class="hljs-attr">width</span>=<span class="hljs-string">"462"</span>
          <span class="hljs-attr">height</span>=<span class="hljs-string">"844"</span>
          <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 0 462 844"</span>
          <span class="hljs-attr">fill</span>=<span class="hljs-string">"none"</span>
          <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span>
          <span class="hljs-attr">className</span>=<span class="hljs-string">"w-full h-full"</span>
        &gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">path</span>
            <span class="hljs-attr">d</span>=<span class="hljs-string">"M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5"</span>
            <span class="hljs-attr">stroke</span>=<span class="hljs-string">"#0000FF"</span>
            <span class="hljs-attr">strokeWidth</span>=<span class="hljs-string">"8"</span>
          /&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">path</span>
            <span class="hljs-attr">d</span>=<span class="hljs-string">"M37.7316 37.3941L46.4471 37.0985C46.7214 37.0872 46.9392 36.9896 47.1001 36.8317L60.2671 45.3825C62.7497 46.9947 65.6719 46.8955 66.7971 45.163L73.9314 34.1771C75.0579 32.4425 73.9598 29.7326 71.4773 28.1204L58.3102 19.5696C58.3877 19.3605 58.3896 19.1198 58.2883 18.8645L55.0122 10.7844C54.706 10.0288 53.6614 9.44663 52.673 9.47815C51.6862 9.51362 51.134 10.152 51.4373 10.9057L53.7501 16.6082L41.4135 8.59676C38.9339 6.98646 36.0087 7.08368 34.8822 8.81829L27.7479 19.8042C26.6228 21.5367 27.7237 24.2485 30.2034 25.8588L42.5399 33.8703L36.387 34.081C35.5765 34.1085 35.2193 34.8705 35.5882 35.7864C35.9614 36.7022 36.9182 37.4197 37.7316 37.3941ZM56.9649 23.0482L56.3711 23.9626L46.2266 17.3747L46.8204 16.4603L56.9649 23.0482ZM40.0447 12.0601L43.6442 15.6977L37.5977 25.0085L32.8092 23.2018L40.0447 12.0601ZM39.5849 27.602L40.1801 26.6855L50.3246 33.2734L49.7294 34.1899L39.5849 27.602ZM52.8688 34.9256L58.9153 25.6149L63.7025 27.4236L56.467 38.5653L52.8688 34.9256Z"</span>
            <span class="hljs-attr">fill</span>=<span class="hljs-string">"#E52A2D"</span>
          /&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span></span>
  );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> PathAnimation;
</code></pre>
<p>Now, if you save and look at the browser, you should be able to see the SVG covering up the whole screen.</p>
<h2 id="heading-integrating-gsap-with-nextjs">Integrating GSAP with Next.js</h2>
<p>Oh the juicy part, let's start with the animation. We got to move that car along the path, right? Let's do that.</p>
<h3 id="heading-importing-gsap-into-nextjs-components">Importing GSAP into Next.js components</h3>
<p>First we need to import the gsap and then import the useGSAP hook. The useGSAP hook is fairly new release and you don't find it around the internet (as of early 2024).</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> gsap <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap"</span>;
<span class="hljs-keyword">import</span> { useGSAP } <span class="hljs-keyword">from</span> <span class="hljs-string">"@gsap/react"</span>;
</code></pre>
<p>After that, we need to import the plugins and register those plugins:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> MotionPathHelper <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap/MotionPathPlugin"</span>;
<span class="hljs-keyword">import</span> { ScrollTrigger } <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap/ScrollTrigger"</span>;

gsap.registerPlugin(useGSAP, ScrollTrigger);
gsap.registerPlugin(MotionPathHelper);
</code></pre>
<p>That's all about importing and registering stuffs related to GSAP. Now, let's move on to the next part.</p>
<h3 id="heading-using-useref-to-handle-events">Using useRef to handle events</h3>
<p>You know in react and next.js, we cannot directly manipulate the elements. So, we need to use useRef hook. We're going to have four refs:</p>
<pre><code class="lang-typescript">  <span class="hljs-keyword">const</span> lineRef = useRef&lt;SVGPathElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> carRef = useRef&lt;SVGPathElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> container = useRef&lt;SVGSVGElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> sectionRef = useRef&lt;HTMLDivElement&gt;(<span class="hljs-literal">null</span>);
</code></pre>
<p>As you might have already guessed where you need to place these refs. Well, here it is:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">section</span>
      <span class="hljs-attr">className</span>=<span class="hljs-string">"py-16 px-4 md:px-2 bg-secondary w-full"</span>
      <span class="hljs-attr">ref</span>=<span class="hljs-string">{sectionRef}</span>
    &gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">{</span>`<span class="hljs-attr">max-w-</span>[<span class="hljs-attr">1250px</span>] <span class="hljs-attr">w-full</span> <span class="hljs-attr">mx-auto</span> <span class="hljs-attr">relative</span> <span class="hljs-attr">mt-16</span> <span class="hljs-attr">mb-20</span>`}&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">svg</span>
          <span class="hljs-attr">width</span>=<span class="hljs-string">"462"</span>
          <span class="hljs-attr">height</span>=<span class="hljs-string">"844"</span>
          <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 0 462 844"</span>
          <span class="hljs-attr">fill</span>=<span class="hljs-string">"none"</span>
          <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span>
          <span class="hljs-attr">className</span>=<span class="hljs-string">"w-full h-full overflow-visible"</span>
          <span class="hljs-attr">ref</span>=<span class="hljs-string">{container}</span>
        &gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">path</span>
            <span class="hljs-attr">ref</span>=<span class="hljs-string">{lineRef}</span>
            <span class="hljs-attr">d</span>=<span class="hljs-string">"M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5"</span>
            <span class="hljs-attr">stroke</span>=<span class="hljs-string">"#0000FF"</span>
            <span class="hljs-attr">strokeWidth</span>=<span class="hljs-string">"8"</span>
          /&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">path</span>
            <span class="hljs-attr">ref</span>=<span class="hljs-string">{carRef}</span>
            <span class="hljs-attr">d</span>=<span class="hljs-string">"M45.5126 32.8551L52.6609 27.8605C52.8849 27.7015 53.0143 27.5011 53.0633 27.281L68.7632 27.281C71.7233 27.281 74.1201 25.6064 74.1201 23.5405V10.4414C74.1201 8.37307 71.7233 6.69838 68.7632 6.69838L53.0633 6.69838C53.0143 6.4808 52.8849 6.27788 52.6609 6.11897L45.5126 1.12674C44.8442 0.659786 43.6511 0.740459 42.8393 1.3052C42.0311 1.87239 41.9156 2.70852 42.5804 3.17547L47.6259 6.69838L32.9163 6.69838C29.9596 6.69838 27.5593 8.37307 27.5593 10.4414L27.5593 23.5405C27.5593 25.6064 29.9596 27.281 32.9163 27.281L47.6259 27.281L42.5804 30.8088C41.9156 31.2734 42.0311 32.107 42.8393 32.6742C43.6511 33.239 44.8442 33.3196 45.5126 32.8551ZM53.8296 10.3485V11.4388L41.7337 11.4388V10.3485L53.8296 10.3485ZM33.6545 10.3485L38.6546 11.4388L38.6546 22.5406L33.6545 23.6334L33.6545 10.3485ZM41.7337 23.6334V22.5406L53.8296 22.5406L53.8296 23.6334L41.7337 23.6334ZM56.8632 22.5406V11.4388L61.8632 10.3485L61.8632 23.6334L56.8632 22.5406Z"</span>
            <span class="hljs-attr">fill</span>=<span class="hljs-string">"#E52A2D"</span>
          /&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span></span>
  );
</code></pre>
<blockquote>
<p>The svg code for car has been changed. Basically, I rotated the card. That's all.<br />So, after changing the path element, import the useEffect hook from react and we are going to set the position of the car.</p>
</blockquote>
<pre><code class="lang-javascript">useEffect(<span class="hljs-function">() =&gt;</span> {
    gsap.set(carRef.current, {
      <span class="hljs-attr">yPercent</span>: <span class="hljs-number">0</span>,
      <span class="hljs-attr">xPercent</span>: <span class="hljs-number">20</span>,
      <span class="hljs-attr">rotate</span>: <span class="hljs-number">30</span>,
    });
  }, []);
</code></pre>
<p>The above code positions the car at <code>y=0%</code>, <code>x=20%</code> and <code>rotation=30deg</code> (property names aren't exactly the same, it's used to just explain)</p>
<p>So, our path is there, car is there. And our code looks like this:</p>
<pre><code class="lang-typescript"><span class="hljs-string">"use client"</span>;
<span class="hljs-keyword">import</span> { useEffect, useRef } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-comment">//gsap</span>
<span class="hljs-keyword">import</span> gsap <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap"</span>;
<span class="hljs-keyword">import</span> { useGSAP } <span class="hljs-keyword">from</span> <span class="hljs-string">"@gsap/react"</span>;
<span class="hljs-keyword">import</span> MotionPathHelper <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap/MotionPathPlugin"</span>;
<span class="hljs-keyword">import</span> { ScrollTrigger } <span class="hljs-keyword">from</span> <span class="hljs-string">"gsap/ScrollTrigger"</span>;

gsap.registerPlugin(useGSAP, ScrollTrigger);
gsap.registerPlugin(MotionPathHelper);

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">PathAnimation</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> lineRef = useRef&lt;SVGPathElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> carRef = useRef&lt;SVGPathElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> container = useRef&lt;SVGSVGElement&gt;(<span class="hljs-literal">null</span>);
  <span class="hljs-keyword">const</span> sectionRef = useRef&lt;HTMLDivElement&gt;(<span class="hljs-literal">null</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    gsap.set(carRef.current, {
      yPercent: <span class="hljs-number">0</span>,
      xPercent: <span class="hljs-number">20</span>,
      rotate: <span class="hljs-number">30</span>,
    });
  }, []);

  <span class="hljs-keyword">return</span> (
    &lt;section
      className=<span class="hljs-string">"py-16 px-4 md:px-2 bg-secondary w-full"</span>
      ref={sectionRef}
    &gt;
      &lt;div className={<span class="hljs-string">`max-w-[1250px] w-full mx-auto relative mt-16 mb-20`</span>}&gt;
        &lt;svg
          width=<span class="hljs-string">"462"</span>
          height=<span class="hljs-string">"844"</span>
          viewBox=<span class="hljs-string">"0 0 462 844"</span>
          fill=<span class="hljs-string">"none"</span>
          xmlns=<span class="hljs-string">"http://www.w3.org/2000/svg"</span>
          className=<span class="hljs-string">"w-full h-full overflow-visible"</span>
          ref={container}
        &gt;
          &lt;path
            ref={lineRef}
            d=<span class="hljs-string">"M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5"</span>
            stroke=<span class="hljs-string">"#0000FF"</span>
            strokeWidth=<span class="hljs-string">"8"</span>
          /&gt;
          &lt;path
            ref={carRef}
            d=<span class="hljs-string">"M45.5126 32.8551L52.6609 27.8605C52.8849 27.7015 53.0143 27.5011 53.0633 27.281L68.7632 27.281C71.7233 27.281 74.1201 25.6064 74.1201 23.5405V10.4414C74.1201 8.37307 71.7233 6.69838 68.7632 6.69838L53.0633 6.69838C53.0143 6.4808 52.8849 6.27788 52.6609 6.11897L45.5126 1.12674C44.8442 0.659786 43.6511 0.740459 42.8393 1.3052C42.0311 1.87239 41.9156 2.70852 42.5804 3.17547L47.6259 6.69838L32.9163 6.69838C29.9596 6.69838 27.5593 8.37307 27.5593 10.4414L27.5593 23.5405C27.5593 25.6064 29.9596 27.281 32.9163 27.281L47.6259 27.281L42.5804 30.8088C41.9156 31.2734 42.0311 32.107 42.8393 32.6742C43.6511 33.239 44.8442 33.3196 45.5126 32.8551ZM53.8296 10.3485V11.4388L41.7337 11.4388V10.3485L53.8296 10.3485ZM33.6545 10.3485L38.6546 11.4388L38.6546 22.5406L33.6545 23.6334L33.6545 10.3485ZM41.7337 23.6334V22.5406L53.8296 22.5406L53.8296 23.6334L41.7337 23.6334ZM56.8632 22.5406V11.4388L61.8632 10.3485L61.8632 23.6334L56.8632 22.5406Z"</span>
            fill=<span class="hljs-string">"#E52A2D"</span>
          /&gt;
        &lt;/svg&gt;
      &lt;/div&gt;
    &lt;/section&gt;
  );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> PathAnimation;
</code></pre>
<p>Now, the only thing remaining is the ignition of the engine and letting the car move.</p>
<h3 id="heading-creating-animation-timelines">Creating animation timelines</h3>
<p>It's time to use <code>useGSAP</code> hook provided by gsap to create an animation timeline.</p>
<pre><code class="lang-typescript">useGSAP(
    <span class="hljs-function">(<span class="hljs-params">context, contextSafe</span>) =&gt;</span> {
      <span class="hljs-keyword">let</span> tl = gsap.timeline({});

      tl.to(carRef.current, {
        motionPath: {
          path: lineRef.current || <span class="hljs-string">""</span>,
          align: lineRef.current || <span class="hljs-string">""</span>,
        },
        ease: <span class="hljs-string">"power1.inOut"</span>,
      });

      <span class="hljs-keyword">return</span> tl;
    },
    {
      scope: container,
    }
  );
</code></pre>
<p>The above timeline is a basic timeline. If you want to dive deep into the <code>useGSAP</code> hook then I recommend this <a target="_blank" href="https://gsap.com/resources/React/">official documentation</a>. Allow me to simplify further.</p>
<p>First, we are creating a timeline with <code>gsap.timeline({})</code> and we're passing empty object because we don't want to pass anything right now (we'll do in a few seconds). Then the timeline is stored in <code>tl</code> variable, tl is short for the timeline. We're storing the timeline on a variable to easily access the timeline in the future.</p>
<p>Then, we're passing the actual props to animate the stuff. The animation is targeted to the car path, we're using <code>carRef</code> to point to our car. Then, we're proving motionPath, inside of the motionPath, we can provide the path (along which the car moves) and another path (along which the car aligns).</p>
<p>At the end, we're providing the scope also. It's helpful when you've multiple animations and you don't want to mess up.</p>
<p><strong>Now, let's make a final timeline.</strong></p>
<pre><code class="lang-typescript">useGSAP(
    <span class="hljs-function">(<span class="hljs-params">context, contextSafe</span>) =&gt;</span> {
      <span class="hljs-keyword">let</span> tl = gsap.timeline({
        scrollTrigger: {
          trigger: sectionRef.current,
          scrub: <span class="hljs-literal">true</span>,
          start: <span class="hljs-string">"top center"</span>,
          end: <span class="hljs-string">"bottom center"</span>,
        },
      });

      tl.to(carRef.current, {
        motionPath: {
          path: lineRef.current || <span class="hljs-string">""</span>,
          align: lineRef.current || <span class="hljs-string">""</span>,
          alignOrigin: [<span class="hljs-number">0.2</span>, <span class="hljs-number">0.5</span>],
          autoRotate: <span class="hljs-literal">true</span>,
          start: <span class="hljs-number">0</span>,
          end: <span class="hljs-number">1</span>,
        },
        ease: <span class="hljs-string">"power1.inOut"</span>,
      });

      <span class="hljs-keyword">return</span> tl;
    },
    {
      scope: container,
    }
  );
</code></pre>
<p>Here, we're triggering the animation on scroll with <code>scrollTrigger</code>. Inside scrollTrigger, we're passing a trigger prop; trigger prop is used to identify by with element the animation is going to trigger. Here we're triggering or starting the animation when the section is scrolled halfway to the screen from the top and stops when the bottom end of the section goes halfway through the screen. <code>scrub</code> is set true to allow animation to take place both forward and backward.</p>
<p>Next, we're aligning the car to perfectly center in that path and also allowing the car to <code>autoRotate</code> so that the car makes a smooth turn. And, you can add a lot of transitions. Choose the one that suits you best.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, you learned how to create SVG path animations using GSAP in a Next.js project. We covered setting up the development environment, installing necessary packages, creating and importing SVG graphics, and integrating GSAP for smooth animations triggered by scroll events. By the end, you have a car following a path on your webpage, showcasing the power of SVG and GSAP animations.</p>
<p>I would like to end this article with a few resources:</p>
<ul>
<li><p>GitHub repository -&gt; <a target="_blank" href="https://github.com/aashishpanthi/svg-path-animation">https://github.com/aashishpanthi/svg-path-animation</a></p>
</li>
<li><p>CodeSandBox -&gt; <a target="_blank" href="https://codesandbox.io/p/github/aashishpanthi/svg-path-animation/main?import=true&amp;layout=%257B%2522sidebarPanel%2522%253A%2522GIT%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clwp8kxl100063b6j9im4qi9g%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clwp8kxl100023b6ja2czavno%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clwp8kxl100043b6jc6n9dpdg%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clwp8kxl100053b6jo9jtj191%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clwp8kxl100023b6ja2czavno%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clwp8kxl100013b6jig8jbxu5%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%257D%255D%252C%2522id%2522%253A%2522clwp8kxl100023b6ja2czavno%2522%252C%2522activeTabId%2522%253A%2522clwp8kxl100013b6jig8jbxu5%2522%257D%252C%2522clwp8kxl100053b6jo9jtj191%2522%253A%257B%2522id%2522%253A%2522clwp8kxl100053b6jo9jtj191%2522%252C%2522activeTabId%2522%253A%2522clwp8mb6200cx3b6j8ef93v7p%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522SETUP_TASKS%2522%252C%2522id%2522%253A%2522clwp8mb6200cx3b6j8ef93v7p%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522CHANGELOG%2522%252C%2522id%2522%253A%2522clwp8mgre00dv3b6jdz8l8tkv%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%252C%2522clwp8kxl100043b6jc6n9dpdg%2522%253A%257B%2522id%2522%253A%2522clwp8kxl100043b6jc6n9dpdg%2522%252C%2522activeTabId%2522%253A%2522clwp8mb4a00bz3b6jrm3lfwwr%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clwp8kxl100033b6jp2eh486t%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522clwp8ky62000rdjd17ehq7284%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522CSB_RUN_OUTSIDE_CONTAINER%253D1%2520devcontainer%2520templates%2520apply%2520--template-id%2520%255C%2522ghcr.io%252Fdevcontainers%252Ftemplates%252Ftypescript-node%255C%2522%2520--template-args%2520%27%257B%257D%27%2520--features%2520%27%255B%255D%27%2522%252C%2522id%2522%253A%2522clwp8m9mg008k3b6jaicuoua1%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522id%2522%253A%2522clwp8mb4a00bz3b6jrm3lfwwr%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D">https://codesandbox.io/p/github/aashishpanthi/svg-path-animation/main</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Dynamic Open Graph Image generator  using Vercel-og]]></title><description><![CDATA[Ever thought of building something and got busy with other tasks? And... suddenly remembered the idea? And... you really worked on it? Well that's what happened to me with this idea.
The beauty of being a programmer is that you can build anything, no...]]></description><link>https://blog.aashish-panthi.com.np/dynamic-open-graph-image-generator-using-vercel-og</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/dynamic-open-graph-image-generator-using-vercel-og</guid><category><![CDATA[SEO]]></category><category><![CDATA[Vercel]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[React]]></category><category><![CDATA[openGraph]]></category><category><![CDATA[HTML5]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Sat, 06 Apr 2024 13:54:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1712411471417/3dbc7e3d-4c57-4788-8601-2ee99a9f7111.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Ever thought of building something and got busy with other tasks? And... suddenly remembered the idea? And... you really worked on it? Well that's what happened to me with this idea.</p>
<p>The beauty of being a programmer is that you can build anything, not a money machine of course - that's illegal.</p>
<h2 id="heading-the-idea">The idea</h2>
<p>The whole idea of this project is to make a dynamic <a target="_blank" href="https://university.webflow.com/lesson/open-graph-settings?topics=site-settings#:~:text=the%20image%20that%20displays%20above%20the%20title%20and%20description">OG(open-graph) image</a>. When I say open graph image, I mean the image that displays above the title and description when you share the link in chat or somewhere on social media that has a link preview.</p>
<p>Despite a static image, I wanted to build an image that changes, like really changes over time. Something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712396407302/8764f76e-71ef-4968-8839-e9a7f6e55d5c.gif" alt class="image--center mx-auto" /></p>
<p>Yes, I wanted to build a countdown timer and just throw it up into social media and see the clock ticking - tic tic tic,</p>
<blockquote>
<p>So this type of dynamic og image isn't just a crazy idea it's helpful too. I want you to think a situation like you have your birthday comming up and you want to do something awesome like making a website for invitation and when you share the invitation on chat then instead of just good old boring og:title and og:description, you now have a damn big og:image with some text like "my dear boy George you suck at your life but you're invited to my birthday party."</p>
<p>Think how quickly George notices his name on the OG image. Although he won't be happy reading that but hey we just sent an extraordinary invitation.</p>
</blockquote>
<h2 id="heading-goal">Goal</h2>
<p>So the goal of this project would be to build a countdown timer instead of the birthday invitation OG image. We're going to do that in typescript and will be using <code>@vercel/og</code>. And that's it.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<ul>
<li><p>You've time and an eagerness to learn.</p>
</li>
<li><p>You should be somewhat familiar with Nextjs because we're going to use that. You can just go through this article even if you only know React.</p>
</li>
<li><p>I expect you to know TypeScript but if you don't it's fine. Even I suck with typescript. Also, for you plain JavaScript lovers out there, I'll be leaving the JavaScript code at the end.</p>
</li>
</ul>
<h2 id="heading-building-the-dynamic-countdown-og-image-with-vercel-og"><strong>Building the Dynamic Countdown OG Image with Vercel OG</strong></h2>
<p>Now, let's dive into the code implementation!</p>
<h3 id="heading-project-initialization">Project Initialization</h3>
<p>First, we need to create a next application which we can do with the following command:</p>
<pre><code class="lang-bash">npx create-next-app vercel-og
</code></pre>
<p>Now configure the nextjs application just how you prefer. If you want to do it like me then here is what I did.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712399190006/9831b1eb-5f68-4f48-bc95-adfe7d79d6cd.png" alt="Next js project initialization" class="image--center mx-auto" /></p>
<p>You gotta wait some time for the dependencies to be installed. Once that happens, you can see the success message that looks exactly like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712399354561/bbe94471-4745-4ea2-af46-872249ef9ac6.png" alt="Nextjs project successfully initialized" class="image--center mx-auto" /></p>
<p>Let me show you a quick hack to open our project in VS Code editor. Surely, I don't expect you to know this. Please, I just want to look cool for real.<br />To open the project in VS Code, the first thing you need is the VS Code which you can download from <a target="_blank" href="https://code.visualstudio.com/">code.visualstudio.com</a>. Once you have the editor you need to move to the project directory with the cd command.</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> vercel-og
</code></pre>
<p>Then to open the project inside of the VS Code editor, you run the following command:</p>
<pre><code class="lang-bash">code .
</code></pre>
<p>If you're lazy like me, instead of the two separate commands that we discussed above we can use only one. Let me show you:</p>
<pre><code class="lang-bash">code ./vercel-og/
</code></pre>
<p>And that works.<br />So, now we need to see if we successfully initialized a next application or not. To run the application, you the npm run dev command:</p>
<pre><code class="lang-bash">npm run dev
</code></pre>
<p>And you need to open up a browser and visit localhost:3000. Then you need to wait for the code to compile. I've been there so I know how painful it is but just wait and after a minute or so you will see the website that looks something like this (it really depends on which version of nextjs you're installing):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712399996860/a630347a-6404-4679-b845-74c573f198f7.png" alt="Nextjs application" class="image--center mx-auto" /></p>
<h3 id="heading-generate-dynamic-image">Generate dynamic image</h3>
<p>So, if you remember I said we are going to use <code>vercel/og</code> package to generate a dynamic image. Lets install the package. You can run the npm install command to install the package:</p>
<pre><code class="lang-bash">npm i @vercel/og
</code></pre>
<p>If you don't know about this package then you can learn more about it on <a target="_blank" href="https://vercel.com/docs/functions/og-image-generation">vercel's website</a> or on the <a target="_blank" href="https://www.npmjs.com/package/@vercel/og">npmjs.com</a>.</p>
<blockquote>
<p>One thing I forgot to remind you is that App router includes @vercel/og. So no need to install it. But if you aren't using the app router or doing this on your react app, install the package.</p>
<p>And <mark>we're using the App router in this example.</mark></p>
</blockquote>
<p>Now let's create a file inside of our project. Just go inside of the app folder and create an api folder, inside that create another folder named of then create a new file inside the og folder and name it route.tsx</p>
<p>The project tree looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712406657182/708f6f1d-6804-40dc-aa41-6280aef9130a.png" alt="Project tree" class="image--center mx-auto" /></p>
<p>And inside of that <code>route.ts</code> file, the magic happens; the magic of dynamic image generation.</p>
<p>First, let's just try pasting the code vercel provided as <a target="_blank" href="https://vercel.com/docs/functions/og-image-generation#getting-started">an example</a>.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { ImageResponse } <span class="hljs-keyword">from</span> <span class="hljs-string">'next/og'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> runtime = <span class="hljs-string">'edge'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">GET</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ImageResponse(
    (
      &lt;div
        style={{
          fontSize: <span class="hljs-number">40</span>,
          color: <span class="hljs-string">'black'</span>,
          background: <span class="hljs-string">'white'</span>,
          width: <span class="hljs-string">'100%'</span>,
          height: <span class="hljs-string">'100%'</span>,
          padding: <span class="hljs-string">'50px 200px'</span>,
          textAlign: <span class="hljs-string">'center'</span>,
          justifyContent: <span class="hljs-string">'center'</span>,
          alignItems: <span class="hljs-string">'center'</span>,
        }}
      &gt;
        👋 Hello
      &lt;/div&gt;
    ),
    {
      width: <span class="hljs-number">1200</span>,
      height: <span class="hljs-number">630</span>,
    },
  );
}
</code></pre>
<p>And those freaking out thinking the above code is in typescript, just look at it dude that's just the plain javascript. No type declaration is done.</p>
<p>Now try opening localhost:3000/api/og on your browser and you can see an image there. Hey, that's a sweet hello right there.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712406771848/971fa318-f3aa-40bd-8faf-0def3691cb85.png" alt="Vercel Open Graph image generation" class="image--center mx-auto" /></p>
<p>Now that we know how we can generate the dynamic image, we need to do some customization and then we'll end up with the perfect OG image we need. So, to style the components we can use style attribute. We can also use the tailwind css but it's in the experimental phase and just to be on safe side, I'm going to use the style attribute.</p>
<p>But before that let's play with date and time for a bit. So, we will have <code>eventDate</code> which of course is the date of the event that is happening and <code>currentDate</code> which is the date when the OG image gets generated. Then we will calculate the time difference between the eventDate and currentDate and try to come up with numbers in days, hours, minutes and seconds. And the code below works flawlessly.</p>
<pre><code class="lang-typescript">  <span class="hljs-keyword">const</span> eventDate = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(<span class="hljs-string">"May 4, 2024"</span>);
  <span class="hljs-keyword">const</span> currentDate = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>();
  <span class="hljs-keyword">const</span> timeRemaining = eventDate.getTime() - currentDate.getTime();

  <span class="hljs-keyword">const</span> days = <span class="hljs-built_in">Math</span>.floor(timeRemaining / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">24</span>));
  <span class="hljs-keyword">const</span> hours = <span class="hljs-built_in">Math</span>.floor(
    (timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">24</span>)) / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>)
  );
  <span class="hljs-keyword">const</span> minutes = <span class="hljs-built_in">Math</span>.floor((timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>)) / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span>));
  <span class="hljs-keyword">const</span> seconds = <span class="hljs-built_in">Math</span>.floor((timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span>)) / <span class="hljs-number">1000</span>);
</code></pre>
<p>Now that we have the numbers to present. We will make a place to present, basically we will make a skeleton with some styling and just place the variables we created above into that. So, the HTML or so called JSX that is used to generate the yellow OG countdown time is this:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> Time = <span class="hljs-function">() =&gt;</span> (
    &lt;div
      style={{
        display: <span class="hljs-string">"flex"</span>,
        flexDirection: <span class="hljs-string">"column"</span>,
        alignItems: <span class="hljs-string">"center"</span>,
        justifyContent: <span class="hljs-string">"center"</span>,
        fontSize: <span class="hljs-number">40</span>,
        color: <span class="hljs-string">"black"</span>,
        background: <span class="hljs-string">"#ffd54f"</span>,
        width: <span class="hljs-string">"100%"</span>,
        height: <span class="hljs-string">"100%"</span>,
        padding: <span class="hljs-string">"20px"</span>,
        border: <span class="hljs-string">"3px solid #ddd"</span>,
        borderRadius: <span class="hljs-string">"10px"</span>,
      }}
    &gt;
      &lt;h1
        style={{
          fontWeight: <span class="hljs-string">"normal"</span>,
          letterSpacing: <span class="hljs-string">".125rem"</span>,
          textTransform: <span class="hljs-string">"uppercase"</span>,
          fontSize: <span class="hljs-string">"3rem"</span>,
        }}
      &gt;
        Countdown to my event
      &lt;/h1&gt;
      &lt;div
        style={{
          display: <span class="hljs-string">"flex"</span>,
          maxWidth: <span class="hljs-string">"100%"</span>,
        }}
      &gt;
        &lt;ul&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"days"</span>
            &gt;
              {days &lt; <span class="hljs-number">10</span> ? <span class="hljs-string">`0<span class="hljs-subst">${days}</span>`</span> : days}
            &lt;/span&gt;
            days
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"hours"</span>
            &gt;
              {hours.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Hours
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"minutes"</span>
            &gt;
              {minutes.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Minutes
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"seconds"</span>
            &gt;
              {seconds.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Seconds
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  );
</code></pre>
<p>Now, that we have date and image, we need to return the image as a response on GET request. To do that we'll create a function like this:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { ImageResponse } <span class="hljs-keyword">from</span> <span class="hljs-string">"next/og"</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> runtime = <span class="hljs-string">"edge"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">GET</span>(<span class="hljs-params"></span>) </span>{
 <span class="hljs-comment">// all the date and tme calculation stuffs we did should be here</span>

 <span class="hljs-comment">// the Time component</span>

  <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ImageResponse(&lt;Time /&gt;, {
    width: <span class="hljs-number">1200</span>,
    height: <span class="hljs-number">630</span>,
  });
}
</code></pre>
<p>So, the whole code of the <code>route.tsx</code> file looks like this:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { ImageResponse } <span class="hljs-keyword">from</span> <span class="hljs-string">"next/og"</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> runtime = <span class="hljs-string">"edge"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">GET</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> eventDate = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(<span class="hljs-string">"May 4, 2024"</span>);
  <span class="hljs-keyword">const</span> currentDate = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>();
  <span class="hljs-keyword">const</span> timeRemaining = eventDate.getTime() - currentDate.getTime();

  <span class="hljs-keyword">const</span> days = <span class="hljs-built_in">Math</span>.floor(timeRemaining / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">24</span>));
  <span class="hljs-keyword">const</span> hours = <span class="hljs-built_in">Math</span>.floor(
    (timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span> * <span class="hljs-number">24</span>)) / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>)
  );
  <span class="hljs-keyword">const</span> minutes = <span class="hljs-built_in">Math</span>.floor((timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>)) / (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span>));
  <span class="hljs-keyword">const</span> seconds = <span class="hljs-built_in">Math</span>.floor((timeRemaining % (<span class="hljs-number">1000</span> * <span class="hljs-number">60</span>)) / <span class="hljs-number">1000</span>);

  <span class="hljs-keyword">const</span> Time = <span class="hljs-function">() =&gt;</span> (
    &lt;div
      style={{
        display: <span class="hljs-string">"flex"</span>,
        flexDirection: <span class="hljs-string">"column"</span>,
        alignItems: <span class="hljs-string">"center"</span>,
        justifyContent: <span class="hljs-string">"center"</span>,
        fontSize: <span class="hljs-number">40</span>,
        color: <span class="hljs-string">"black"</span>,
        background: <span class="hljs-string">"#ffd54f"</span>,
        width: <span class="hljs-string">"100%"</span>,
        height: <span class="hljs-string">"100%"</span>,
        padding: <span class="hljs-string">"20px"</span>,
        border: <span class="hljs-string">"3px solid #ddd"</span>,
        borderRadius: <span class="hljs-string">"10px"</span>,
      }}
    &gt;
      &lt;h1
        style={{
          fontWeight: <span class="hljs-string">"normal"</span>,
          letterSpacing: <span class="hljs-string">".125rem"</span>,
          textTransform: <span class="hljs-string">"uppercase"</span>,
          fontSize: <span class="hljs-string">"3rem"</span>,
        }}
      &gt;
        Countdown to my event
      &lt;/h1&gt;
      &lt;div
        style={{
          display: <span class="hljs-string">"flex"</span>,
          maxWidth: <span class="hljs-string">"100%"</span>,
        }}
      &gt;
        &lt;ul&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"days"</span>
            &gt;
              {days &lt; <span class="hljs-number">10</span> ? <span class="hljs-string">`0<span class="hljs-subst">${days}</span>`</span> : days}
            &lt;/span&gt;
            days
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"hours"</span>
            &gt;
              {hours.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Hours
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"minutes"</span>
            &gt;
              {minutes.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Minutes
          &lt;/li&gt;
          &lt;li
            style={{
              display: <span class="hljs-string">"block"</span>,
              fontSize: <span class="hljs-string">"1.5rem"</span>,
              listStyleType: <span class="hljs-string">"none"</span>,
              padding: <span class="hljs-string">"1em"</span>,
              textTransform: <span class="hljs-string">"uppercase"</span>,
            }}
          &gt;
            &lt;span
              style={{
                display: <span class="hljs-string">"block"</span>,
                fontSize: <span class="hljs-string">"4.5rem"</span>,
              }}
              id=<span class="hljs-string">"seconds"</span>
            &gt;
              {seconds.toString().padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>)}
            &lt;/span&gt;
            Seconds
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  );

  <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ImageResponse(&lt;Time /&gt;, {
    width: <span class="hljs-number">1200</span>,
    height: <span class="hljs-number">630</span>,
  });
}
</code></pre>
<p>And if we visit the same route again or do a quick GET request to our API route, we get the image that should look like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1712408039337/0e59a082-5c2d-4d9f-8790-4111c0fa5014.png" alt="Vercel OG Image generator" class="image--center mx-auto" /></p>
<h3 id="heading-link-the-image-to-meta-tag">Link the image to meta tag</h3>
<p>Now that we've our image ready, what about using it. So, head to <code>layout.tsx</code> file and in here, we'll create some meta tags. The most important one is this one:</p>
<pre><code class="lang-typescript">&lt;meta property=<span class="hljs-string">"og:image"</span> content=<span class="hljs-string">"https://vercel-og-teal.vercel.app/api/og"</span> /&gt;
</code></pre>
<p>If you are wondering that what type of image ends without .jpeg, .png, .svg extensions then you've every right to wonder. Basically, in here the api route we are setting as a content have ImageResponse so that route is essentially giving us an image to use. Now, we have our first meta tag ready, let's add more:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { Metadata } <span class="hljs-keyword">from</span> <span class="hljs-string">"next"</span>;
<span class="hljs-keyword">import</span> { Inter } <span class="hljs-keyword">from</span> <span class="hljs-string">"next/font/google"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"./globals.css"</span>;

<span class="hljs-keyword">const</span> inter = Inter({ subsets: [<span class="hljs-string">"latin"</span>] });

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> metadata: Metadata = {
  title: <span class="hljs-string">"OG Image Generator"</span>,
  description: <span class="hljs-string">"Generated by create next app"</span>,
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">RootLayout</span>(<span class="hljs-params">{
  children,
}: Readonly&lt;{
  children: React.ReactNode;
}&gt;</span>) </span>{
  <span class="hljs-keyword">return</span> (
    &lt;html lang=<span class="hljs-string">"en"</span>&gt;
      &lt;head&gt;
        &lt;meta charSet=<span class="hljs-string">"utf-8"</span> /&gt;
        &lt;meta name=<span class="hljs-string">"viewport"</span> content=<span class="hljs-string">"width=device-width, initial-scale=1"</span> /&gt;

        &lt;link rel=<span class="hljs-string">"icon"</span> href=<span class="hljs-string">"/favicon.ico"</span> /&gt;

        {<span class="hljs-comment">/* Rest of the meta tags */</span>}

        &lt;meta
          property=<span class="hljs-string">"og:image"</span>
          content=<span class="hljs-string">"https://vercel-og-teal.vercel.app/api/og"</span>
        /&gt;
        &lt;meta
          name=<span class="hljs-string">"twitter:image"</span>
          content=<span class="hljs-string">"https://vercel-og-teal.vercel.app/api/og"</span>
        /&gt;
      &lt;/head&gt;

      &lt;body className={inter.className}&gt;{children}&lt;/body&gt;
    &lt;/html&gt;
  );
}
</code></pre>
<p>That file above my dear is our layout.tsx file and we're done with our OG image generation and linking that image kind of things.</p>
<blockquote>
<p>Also, the <code>https://vercel-og-teal.vercel.app</code> points to the version I deployed on vercel so don't forget to replace this link with the base URL of your site.</p>
</blockquote>
<h3 id="heading-dealing-with-cache">Dealing with cache</h3>
<p>Did you try deploying the site and actually sharing it on social media? Didn't get what you expected? Well, blame caching for that. There are basically four types of caching that are playing role in raising this problem:</p>
<ol>
<li><p><strong>Nextjs Caching:</strong></p>
<p> By default, Next.js automatically caches the returned values of fetch in the Data Cache on the server. You can read more about it <a target="_blank" href="https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#:~:text=By%20default%2C%20Next.js%20automatically,reused%20on%20each%20data%20request.&amp;text=However%2C%20there%20are%20exceptions%2C%20fetch,Used%20inside%20a%20Server%20Action.">here</a>.</p>
</li>
<li><p><strong>Vercel Caching:</strong></p>
<p> So, remember we used edge runtime in the code above. Vercel's Edge Cache is used for caching entire static assets at the edge, such as images, fonts, and JavaScript bundles. The Vercel Data Cache is used for caching data fetched during a function's execution, such as API responses. You can read more about it <a target="_blank" href="https://vercel.com/docs/infrastructure/data-cache#:~:text=Vercel's%20Edge%20Cache%20is%20used,execution%2C%20such%20as%20API%20responses.">here</a>. This caching won't be a problem if you aren't using nextjs to deploy your application but there can be similar server caching, so beware of that.</p>
</li>
<li><p><strong>Browser Caching:</strong></p>
<p> So your beloved browser also cache your image and doesn't load up the new data. I found <a target="_blank" href="https://ayushgupta2959.medium.com/supercharging-website-performance-unleashing-the-power-of-browser-caching-a6a59d32ba7f#:~:text=Benefits%20of%20Browser%20Caching&amp;text=Reduced%20Bandwidth%20Usage%3A%20Caching%20reduces,and%20engage%20with%20its%20content.">this great article</a> online that explains the browser caching very well.</p>
</li>
<li><p><strong>Social Media site's own caching:</strong></p>
<p> When you share the link for the first time, the social media sites like facebook, discord get the og:image and they cache it. Literally, the image might be changing on our server but the social media sites cache the image and give us our old image back. You can find each social media's own article to understand how they cache. But sadly, <em>I have to say that our countdown thing won't work while sharing the link in chat.</em></p>
</li>
</ol>
<p>Now, that we know there are things like caching and all. So, let's try to remove them.</p>
<blockquote>
<p>Note: I couldn't find a way to remove the social media site caching.</p>
</blockquote>
<p>On your <code>next.config.mjs</code> file, you basically say don't cache. That's gonna prevent nextjs caching. Here is how you say it:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> nextConfig = {
  <span class="hljs-keyword">async</span> headers() {
    <span class="hljs-keyword">return</span> [
      {
        source: <span class="hljs-string">"/api/:path*"</span>,
        headers: [
          {
            key: <span class="hljs-string">"Cache-Control"</span>,
            value: <span class="hljs-string">"no-store"</span>,
          },
        ],
      },
    ];
  },
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> nextConfig;
</code></pre>
<p>Saw a strange path up there? So, that's what I'll try to explain next.</p>
<p>We're going to change the folder structure. We previously had <code>src/app/api/og/route.tsx</code>. Now, we'll change it to <code>src/app/api/[id]/route.tsx</code>. No, we aren't using id inside of the route.tsx file. We're just using the dynamic routing so that the user can have the different URL while accessing the same image, and that bypasses browser caching and also the vercel one.</p>
<p>Next thing you can do to be extra safe is to use this line of code on your <code>route.tsx</code> file:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> dynamic = <span class="hljs-string">"force-dynamic"</span>;
</code></pre>
<p>This will force not to cache the response. You can learn more about vercel caching here: <a target="_blank" href="https://vercel.com/docs/edge-network/caching">https://vercel.com/docs/edge-network/caching</a></p>
<p>And I've also rendered the image in the lading page of the site and the image looks like this: <a target="_blank" href="https://vercel-og-teal.vercel.app/">https://vercel-og-teal.vercel.app/</a>. Yes, go visit and see the countdown.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This type of dynamic og:image generation comes in handy in a lot of place. We discussed two scenarios and really build one of them. Of course, it didn't work out as expected. So, countdown isn't really possible wherever and wherever the social media caching exist. So, at the end all I want to say is just have fun coding and...</p>
<p>Subscribe to my newsletter below. You know what type of content you can expect from me :)</p>
]]></content:encoded></item><item><title><![CDATA[Add Website Loading Animation: a comprehensive guide]]></title><description><![CDATA[In the fast-paced world of web development, creating an engaging and seamless user experience is important. One effective way to achieve this is by implementing a loading animation on your website. In this tutorial, we'll explore the step-by-step pro...]]></description><link>https://blog.aashish-panthi.com.np/add-website-loading-animation</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/add-website-loading-animation</guid><category><![CDATA[HTML5]]></category><category><![CDATA[CSS]]></category><category><![CDATA[loading]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Sun, 04 Feb 2024 18:11:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1707070360551/c7fdd007-0efc-4cda-ba1a-9c6c5f470941.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the fast-paced world of web development, creating an engaging and seamless user experience is important. One effective way to achieve this is by implementing a loading animation on your website. In this tutorial, we'll explore the step-by-step process of creating a visually appealing loading spinner using HTML, CSS, and JavaScript—no jQuery required!</p>
<h2 id="heading-why-loading-animations-matter"><strong>Why Loading Animations Matter</strong></h2>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExOHp4dXh3d211ZmlsNmw3MXBtdTlraW14Mndrb2IzZ2J2NXpvOWVrMiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l3nWhI38IWDofyDrW/giphy.gif" alt class="image--center mx-auto" /></p>
<p>Loading animations not only serve a practical purpose by indicating to users that your page is loading, but they also contribute to the overall aesthetics of your website. A well-designed loading animation can create a positive first impression, keeping users engaged during the brief loading period.</p>
<h2 id="heading-the-tools-well-use"><strong>The Tools We'll Use</strong></h2>
<p>Before we dive into the tutorial, let's briefly go over the tools we'll be using:</p>
<ul>
<li><p><strong>HTML</strong>: The structure of our web page.</p>
</li>
<li><p><strong>CSS</strong>: Styling to make our loading animation visually appealing.</p>
</li>
<li><p><strong>JavaScript</strong>: Dynamic behavior to control when the loading animation appears and disappears.</p>
</li>
</ul>
<h1 id="heading-before-starting">Before starting:</h1>
<p>If you prefer watching videos then you can watch this video to understand how the loader is integrated seamlessly into a website.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=kG4oZJSlPrw">https://www.youtube.com/watch?v=kG4oZJSlPrw</a></div>
<p> </p>
<p>But if you prefer reading then let's code the loader together.</p>
<h3 id="heading-step-1-setting-up-the-html"><strong>Step 1: Setting Up the HTML</strong></h3>
<p>Start by creating the HTML structure of your page. For simplicity, we'll create a loading div that will house our animation:</p>
<pre><code class="lang-xml"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"styles.css"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Your Website<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"loader-wrapper"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"loader"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"content-container"</span>&gt;</span>
            <span class="hljs-comment">&lt;!-- Your website content goes here --&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Hi, there<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>I am the content.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"script.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>In the above code, you see we have a <code>loader</code> with a <code>loader-wrapper</code> and a <code>content-container</code>. The loader is the loader and the content-container houses all of your code that you use while making a website.</p>
<p><strong>Step 2: Styling with CSS</strong></p>
<p>Now, let's add some styles to make our loading animation visually appealing. Create a new file called <code>styles.css</code>:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.loader-wrapper</span>{
    <span class="hljs-attribute">height</span>: <span class="hljs-number">100vh</span>;
    <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
    <span class="hljs-attribute">position</span>: fixed;
    <span class="hljs-attribute">top</span>:<span class="hljs-number">0</span>;
    <span class="hljs-attribute">left</span>:<span class="hljs-number">0</span>;
    <span class="hljs-attribute">display</span>: grid;
    <span class="hljs-attribute">place-items</span>: center;
    <span class="hljs-attribute">background-color</span>:<span class="hljs-number">#fff</span>;
}

<span class="hljs-selector-class">.loader</span> {
    <span class="hljs-attribute">border</span>: <span class="hljs-number">8px</span> solid <span class="hljs-number">#f3f3f3</span>;
    <span class="hljs-attribute">border-top</span>: <span class="hljs-number">8px</span> solid <span class="hljs-number">#3498db</span>;
    <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">50%</span>;
    <span class="hljs-attribute">width</span>: <span class="hljs-number">50px</span>;
    <span class="hljs-attribute">height</span>: <span class="hljs-number">50px</span>;
    <span class="hljs-attribute">animation</span>: spin <span class="hljs-number">1s</span> linear infinite;
}

<span class="hljs-keyword">@keyframes</span> spin {
    0% { <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">rotate</span>(<span class="hljs-number">0deg</span>); }
    100% { <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">rotate</span>(<span class="hljs-number">360deg</span>); }
}
</code></pre>
<p>The above CSS code will make a simple CSS loading animation. If you want a more customized and modern loader on your website then you can code your own or use from <a target="_blank" href="https://css-loaders.com/">https://css-loaders.com/</a> website. They have hundreds of great CSS animations, with source code folk.</p>
<p>Now that you have a loader with loading animation, we need to hide the content container i.e. the div with the id <code>content-container:</code></p>
<pre><code class="lang-css"><span class="hljs-selector-id">#content-container</span> {
    <span class="hljs-attribute">display</span>: none; <span class="hljs-comment">/* Hide the loading container by default */</span>
}
</code></pre>
<p>Now when the loading animation is complete or when our HTML page is completely loaded, we need to show the content, right? I think so.</p>
<p>So to show the content, you can use display property with any values except <em>none.</em> For now, we are going to use the <em>block</em> value:</p>
<pre><code class="lang-css"><span class="hljs-selector-id">#content-container</span><span class="hljs-selector-class">.show</span> {
    <span class="hljs-attribute">display</span>: block; <span class="hljs-comment">/* Display the loading container when 'show' class is added */</span>
    <span class="hljs-comment">/* Add your animation styles here; this is great if you want to show content with animation/transition */</span>
}
</code></pre>
<p>So our final CSS file AKA <code>style.css</code> should look like this:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.loader-wrapper</span>{
    <span class="hljs-attribute">height</span>: <span class="hljs-number">100vh</span>;
    <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
    <span class="hljs-attribute">position</span>: fixed;
    <span class="hljs-attribute">top</span>:<span class="hljs-number">0</span>;
    <span class="hljs-attribute">left</span>:<span class="hljs-number">0</span>;
    <span class="hljs-attribute">display</span>: grid;
    <span class="hljs-attribute">place-items</span>: center;
    <span class="hljs-attribute">background-color</span>:<span class="hljs-number">#fff</span>;
}

<span class="hljs-selector-class">.loader</span> {
    <span class="hljs-attribute">border</span>: <span class="hljs-number">8px</span> solid <span class="hljs-number">#f3f3f3</span>;
    <span class="hljs-attribute">border-top</span>: <span class="hljs-number">8px</span> solid <span class="hljs-number">#3498db</span>;
    <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">50%</span>;
    <span class="hljs-attribute">width</span>: <span class="hljs-number">50px</span>;
    <span class="hljs-attribute">height</span>: <span class="hljs-number">50px</span>;
    <span class="hljs-attribute">animation</span>: spin <span class="hljs-number">1s</span> linear infinite;
}

<span class="hljs-keyword">@keyframes</span> spin {
    0% { <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">rotate</span>(<span class="hljs-number">0deg</span>); }
    100% { <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">rotate</span>(<span class="hljs-number">360deg</span>); }
}

<span class="hljs-selector-id">#content-container</span> {
    <span class="hljs-attribute">display</span>: none; <span class="hljs-comment">/* Hide the loading container by default */</span>
}

<span class="hljs-selector-id">#content-container</span><span class="hljs-selector-class">.show</span> {
    <span class="hljs-attribute">display</span>: block; <span class="hljs-comment">/* Display the loading container when 'show' class is added */</span>
    <span class="hljs-comment">/* Add your animation styles here */</span>
}
</code></pre>
<h3 id="heading-step-3-adding-javascript-logic"><strong>Step 3: Adding JavaScript Logic</strong></h3>
<p>Time to add dynamic behavior! Create a new file called <code>script.js</code> and add this code to your new file.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> content = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"content-container"</span>);
<span class="hljs-keyword">const</span> loader = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".loader-wrapper"</span>);

<span class="hljs-built_in">window</span>.onload = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    content.classList.add(<span class="hljs-string">"show"</span>);
    loader.style.display = <span class="hljs-string">"none"</span>
};
</code></pre>
<p>So what the above code does is: There is a function that runs when the page is fully loaded. When the function is executing, we'll add <code>show</code> class to the <code>content-container</code> which will make the content visible (refer to CSS code if you don't understand). Then we add a style property of <code>display: none;</code> to our loader-wrapper that will just make our loader go kaboom; in other words, make it disappear. Now we have a complete CSS loader on our website.</p>
<h3 id="heading-step-4-customize-your-animation"><strong>Step 4: Customize Your Animation</strong></h3>
<p>Feel free to customize the loading animation by adding your styles and adjusting the timing. Again, I am referring to <a target="_blank" href="https://css-loaders.com/">https://css-loaders.com/</a> website. They really have good CSS animations.</p>
<p><strong>And this is what our final product looks like (play with pen and reload to see loader):</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://codepen.io/aashishpanthi/pen/gOEzVzB">https://codepen.io/aashishpanthi/pen/gOEzVzB</a></div>
<p> </p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>Congratulations! You've successfully implemented a loading animation on your website using HTML, CSS, and JavaScript. By providing users with a visually pleasing loading experience, you've taken a significant step toward enhancing your website's overall appeal.</p>
<p>Remember, a positive user experience goes a long way in retaining visitors and encouraging them to explore your site further. Happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Reflections: My Coding Odyssey in 2023 - Triumphs, Trials, and Tantalizing Tech! 🚀🎢]]></title><description><![CDATA[Get ready for an exhilarating and candid ride through my coding journey in the first half of 2023! 🚀🎢 It's been an exciting journey filled with hardware projects, writing competitions, and hackathons. But let's be real – mobile app development hasn...]]></description><link>https://blog.aashish-panthi.com.np/reflections-my-coding-odyssey-in-2023-triumphs-trials-and-tantalizing-tech</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/reflections-my-coding-odyssey-in-2023-triumphs-trials-and-tantalizing-tech</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[@wemakedev]]></category><category><![CDATA[journey]]></category><category><![CDATA[bragjournal]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Thu, 27 Jul 2023 09:09:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690397140647/06b9ffd4-9f40-4ada-85e4-7b1cd9bf0db8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Get ready for an exhilarating and candid ride through my coding journey in the first half of 2023! 🚀🎢 It's been an exciting journey filled with hardware projects, writing competitions, and hackathons. But let's be real – mobile app development hasn't been my groove. Endless errors and frustrations have dampened the excitement.</p>
<p>But I'm not going to let that slow me down! Countless other code paths still need to be explored, and I'm committed to finding them. Join me as I explore the nuances of programming, create apps, and even complete my dream project. Grab your virtual popcorn because everything from monumental failures to minor triumphs will soon be revealed. Let's start this coding adventure together!</p>
<h2 id="heading-so-what-did-i-do-these-6-months">So, what did I do these 6 months?</h2>
<p>Believe it or not, I went on a journey down memory lane, scouring my tweets, Google photos, and GitHub profile to unearth what I've actually been up to in the last 6 months. With high school now behind me for 2 months, you can imagine the immense pressure I've faced lately. Despite all the odds stacked against me, my progress outside of academics has been, well, a tad bit modest. But fear not, dear reader, for in the rest of this article, you won't be the only one getting to know about me. I'll be spilling the beans and reflecting on my hilarious and not-so-glamorous coding journey!</p>
<p><strong>Next,</strong> Step by step, we'll traverse my eventful coding journey, starting from the early months of the year, as we dive into each task, accomplishment, and adventure! 🌟</p>
<h3 id="heading-hardware-project">Hardware project</h3>
<p>This was my first hardware project. I participated in a science exhibition organized by my school. Technically it was in 2022 as it got finished in the last week of 2022. Alright, I am going to drop some memories below then I will explain more.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690197220459/2b102650-59e8-48ea-a21c-fffaf06d6a60.png" alt="Aashish Panthi getting appreciated after participation in Science exhibition 2022 held in Kalika Manavgyan Secondary School, Butwal" class="image--center mx-auto" /></p>
<p>In our country, the election had concluded, but concerns about vote rigging persisted. Reports had surfaced of votes being cast on behalf of absent individuals, including those who had already passed away or lived abroad. This situation poses a significant challenge to the integrity of the electoral process. To address this issue, my friends and I devised a compelling idea for a hardware project that would ensure vote authenticity and read the fingerprint of the voters.</p>
<p>To summarize the project in short, we took a fingerprint scanner, wrote an Arduino program, and integrated it with other hardware components like LCD, buzzer, and LEDs. And we measured the authenticity of the votes. The experience was really interesting in itself. Interesting in the sense that it was my first time playing with Arduino and I got a lot of problems and the wires created a complete mess but at the same time, we were gathering the experiences and really enjoying the process leaving aside the thought that it was a competition.</p>
<h3 id="heading-develevate-platinum-winner">Develevate platinum winner</h3>
<p>You know I also love to write technical articles. Obviously, you are reading this article because I love to write, no? So, showwcase.com organized a <a target="_blank" href="https://www.showwcase.com/show/25364/dev-elevate-platinum-winners">blogging competition</a> at the start of this year and I participated. If you want to take a look at my blogs, you can visit this link: <a target="_blank" href="https://show.aashish-panthi.com.np/shows">https://show.aashish-panthi.com.np/shows</a>.</p>
<p>But this was one of the good news that I received in the past 6 months. And the news was that I became the platinum winner of Dev Elevate by showwcase. Don't believe it? Here you go:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1614940068602601477">https://twitter.com/aashishpanthi11/status/1614940068602601477</a></div>
<p> </p>
<h3 id="heading-national-hackathon">National hackathon</h3>
<p>Alright, it was a hectic experience. So, to attend an offline Hackathon, my friends formed a team and named it <strong>Debugging army</strong>. It was our first Hackathon and we were excited about it. After all, we traveled around 500 kilometers to participate in that hackathon. Things weren't that smooth. I talked about my horrific experience in one of my previous articles also. I am going to link that, you can read it out.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/debugging-through-the-whole-hackathon">https://blog.aashish-panthi.com.np/debugging-through-the-whole-hackathon</a></div>
<p> </p>
<p>This opportunity taught me many things about the competition, how to travel, and care for my health. This was the first time I traveled with my friends a very long distance and I stayed there for more than a week.</p>
<p>We actually visited a lot of beautiful places. I guess it is one of the most visited destinations by national and international tourists in my country. I really want to share my memories with you. So here it is:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690311864051/86f02db9-109a-4e02-aa82-46fad1c358f8.png" alt="Deltathon dharan 2023 hackathon Nepal. Aashish Panthi as a participant." class="image--center mx-auto" /></p>
<p>Oh, haven't I talked about what we built? So I and my team choose the agriculture track there and made a mobile application and named it CattleCare. So here is its short description:</p>
<blockquote>
<p>CattleCare is the all-in-one solution for managing your cattle. With features like insurance management, vaccination, milk production tracking, etc. Say goodbye to scattered records: hello CattleCare.</p>
</blockquote>
<p>If you are curious to know about it more then we can get a lot more information here:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://devpost.com/software/cattlecare">https://devpost.com/software/cattlecare</a></div>
<p> </p>
<p>I am not faking it, you really get to know your strength, how collaborative you are with the team, and how good you are at task management. This event has changed some of my perceptions. This time I was really stuck for 4 hours during the 24-hour hackathon due to a silly bug that was just mysterious. The process of debugging can be both challenging and rewarding. While it requires dedication, hard work, and a lot of critical things, the happiness you get after solving the error is on the next level.</p>
<p>And one more thing I am going to share about the hackathon is the design of our application. This design was made by <a class="user-mention" href="https://hashnode.com/@saroj-regmi">Saroj Regmi</a>.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/sarojregmi200/status/1661608310750035969">https://twitter.com/sarojregmi200/status/1661608310750035969</a></div>
<p> </p>
<p>My team didn't win, the friends that were with us won the hackathon and became the national champions. Despite the odds, we managed to get some swags and stickers.</p>
<h3 id="heading-desk-setup">Desk setup</h3>
<p>I am not joking before February 1, 2023, I had a very bad posture. I used to sit like a snake while coding. I found a perfect image of my posture before the desk setup.</p>
<p><img src="https://image.myanimelist.net/ui/4s-ebtW7eAYgJwPH6yGLzTXIe6KVqb8UyTQf81I9afLfoED46-MNKumYresGSAySeRhSB4s5lyhRly46jMq-tC8m8aG95jYHi_HuimCC_yD6smSVP4FA2xQ5hsJFGLWM3i4D2Vn2WJ06WrAoOqMjpKInoDauwwuBjjUq5nedM1nx0KsF3unf2GQcv3iV4SNftQfqJl8OM7uLGGQOkpuxtRkiAtIiCnMx6jR35TKmVeDpKI5lAqFW8LFiRNJVcCpg" alt="Post a picture that sums up how you're feeling right now (100 - ) - Forums  - MyAnimeList.net" class="image--center mx-auto" /></p>
<p>Yes, I really had a bad posture and suffered from back pain. My back still hurts man😞. But with the end of January 2023, my bad posture also ended cause I got a new desk and chair for myself.</p>
<p>After bragging this much, how can I not share a picture? Before sharing it, I knew the setup is temporary and it was great having that setup for the next 4 months. So, I didn't go for super expensive, I just bought whatever was cheap.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690397291334/59536dc3-3622-4e0a-ba9d-2c98c135f174.jpeg" alt="Desk Setup for coding by Aashish Panthi" class="image--center mx-auto" /></p>
<p>Actually, it turns out, I didn't click many photos of the setup. So, this was one of the best photos I clicked, I know it's terrible😔.</p>
<p>Now I am back to my original position cause I left the city after finishing high school. And currently, I am in a city of opportunities.</p>
<h3 id="heading-freelancing">Freelancing</h3>
<p>Although I didn't get an expansive setup, still I spent some money. After the desk setup, I felt like I was being more productive. Right then, I also got an offer to work as a freelancer which I immediately accepted. I built some front-end components for him in React using Tailwind CSS. Though it wasn't my first freelancing project, I worked way more this time and earned a few dollars also.</p>
<p><em>Sorry, I can't drop any pictures about this.</em></p>
<h3 id="heading-received-swags">Received swags</h3>
<p>Your boy received swags from showwcase. As a platinum winner, I was supposed to receive a T-shirt, a cap, and a hoodie but I received only a T-shirt and a cap. It turns out they had problems shipping the hoodie but they are still working on it.</p>
<p>So, here is what I received :)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690392777458/c4ebd633-bb67-4360-bb69-1a648e037a41.jpeg" alt="Showwcase swags received by Aashish Panthi" class="image--center mx-auto" /></p>
<p>They hadn't only sent me these swags but they also sent me two showwcase stickers. So here was my laptop's lid after attaching the sticker.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690392850171/173f6a7c-34c5-4fed-b9d9-c254f9afd9cd.jpeg" alt="Stickers in Aashish Panthi's laptop" class="image--center mx-auto" /></p>
<p>Alright, I am not going to brag anymore about this.</p>
<h3 id="heading-exams">Exams</h3>
<p>I think I shouldn't be talking about exams but it followed me everywhere so I have to talk at least a paragraph about it. So, I had the final exams in May 2023. I had to prepare for my exam. After all, I had studied for 12 years straight for this event so you realize how much pressure I felt for this.</p>
<p>Yes, I couldn't learn new technologies or build projects due to exams. Technically, I had time to do all these because only in my mind I was preparing for the exams but the reality was that I was watching some youtube videos and Facebook videos all day long. But sometimes, I also studied and I have that footage.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690360634578/8b9ec0ee-281f-41c9-a8dc-e9592cefdf80.gif" alt="Aashish panthi preparing for 12th board exam" class="image--center mx-auto" /></p>
<p>Yes, I even recorded myself studying. Now think yourself how much I might have studied.</p>
<h3 id="heading-club-assembly">Club Assembly</h3>
<p>How could I even forget about it? So, we had an ICT club in our school. I was serving as IT Head in that club. Basically, I was handling the website of the club and sometimes social media also. And under this immense pressure of the board exam, I even made a website for the club, then for the hackathon which was supposed to happen this June but got canceled.</p>
<p>For those who want to take a look at the club's website, <a target="_blank" href="https://ictkalika.tech/">it's here</a>.</p>
<p>While returning from the national hackathon that I discussed earlier, we thought why not organize a similar hackathon in our school also? So, we started preparing for the hackathon. Some of us reached out to companies asking for sponsorships, some of us invited guests and judges, some started searching for the venue, some started to prepare the designs for the event and I started working on the website.</p>
<p>Back to back, a lot of things we did but our exams got in between and we had even collected more than 50% of the fund for the hackathon but we couldn't progress more because everyone had their own plans after the exams. So the program which was supposed to happen after the board exam got canceled. And I kindly put a canceled watermark on the website also. Here it is:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690361753775/5ca20a44-e2db-4916-965a-0ce02bcfebe0.png" alt="HackthisJune Hackathon by ICT club of KMGSS got cancelled" class="image--center mx-auto" /></p>
<p>Oh, Grammarly just suggested that I spelled the <code>cancelled</code> word wrong.</p>
<p>Despite all odds, our first club assembly happened which was also our official end of tenure. And I received a certificate of appreciation signed by our president <a class="user-mention" href="https://hashnode.com/@sushilbhattarai">Sushil Bhattarai</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690392914905/1c1b8439-5e84-47ea-ae6e-16b48cb96e6f.gif" alt class="image--center mx-auto" /></p>
<p>So, with this smile, I finished high school and tenure of the ICT Club of KMGSS.</p>
<h3 id="heading-surakshya">Surakshya</h3>
<p>The project on which I am currently working is called <strong>Surakshya.</strong> It is a React Native app that will provide safety resources for women in an accessible, simplified manner. You can know more about this <a target="_blank" href="https://www.incubatenepal.com/projects.html">project here</a>.</p>
<p>I am working on mobile application development and again I am facing a lot of problems. I am getting errors time and again. And one of the things I hate about react native is debugging. In fact, I don't like mobile application development just because I can't right-click and inspect.</p>
<p>I am not working alone on this app. This is not a small application to build. It has a lot of parts that have to be combined together. In this <a target="_blank" href="https://www.instagram.com/p/Ctt00QNpzVf/">Instagram post</a>, you can get more information about the project and team members.</p>
<p>Overall, this application is totally a real-world application. It contains real data. It has real contacts and even helps women in need to contact organizations that are working for women's safety in Nepal. The application is in its final stage and will be available in the play store and app store soon.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690448501142/b0a9d430-f6b0-401d-aebb-300edcb0607c.png" alt="Team Surakshya Incubate Nepal" class="image--center mx-auto" /></p>
<p><em>And just now I learned to export designs like this🙃.</em></p>
<p>I learned a lot of new things in this application development process. And I am still learning new things every single day. I am working with map integration in this application and highlighting the regions and handling different events. Another very new thing that I am learning is app localization. We think language shouldn't be a barrier for anyone who wants to use this application. So, I am working on making this application available in different languages.</p>
<p>I am also learning to handle a large dataset. And how to render that immense amount of data on the screen with no lag at all. Also, this is the first time I am using Team, Azure, and other Microsoft developer tools.</p>
<p><em>Soon, I will be sharing the application.</em></p>
<h3 id="heading-articles">Articles</h3>
<p>I have already written 12 articles in the past 6 months. Some are tutorials, some are just reflections on the year 2022. I also took part in DevRetro this year where I received a special mention but no more than that.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690394525396/5ed4f710-46de-4c20-8203-306e221fca6b.png" alt class="image--center mx-auto" /></p>
<p>You can visit <a target="_blank" href="https://blog.aashish-panthi.com.np/">https://blog.aashish-panthi.com.np/</a> to read my articles. I have discussed my problem and also shared how I overcome that and also shared some technical articles and experiences there.</p>
<h3 id="heading-github-contribution">GitHub Contribution</h3>
<p>If you take a look at my previous year's contributions on GitHub and compare it with this year's then it's a lot less. I am going to drop two images here:</p>
<p><em>Contribution graph of 2022:</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690393904555/c0b58181-79a3-45ee-8af3-f40656847e8c.png" alt class="image--center mx-auto" /></p>
<p><em>Contribution graph of 2023:</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690393922246/dc3023f8-7952-495c-bb9a-bfcade500077.png" alt class="image--center mx-auto" /></p>
<p>One of the reasons why I didn't write much code this year is due to my board exam. You can clearly see I didn't do many things in April and May caused my final exam ended on 19th May. And the source code of the mobile application <strong>Surakshya</strong> that I talked about is not stored in GitHub.</p>
<p>We are using Azure DevOps to store files. And sometimes the tree structure gets really complicated.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690394209120/d8b4141e-0be6-4f7c-b7f6-2f87ba75cf1b.png" alt="Azure DevOps repo of Surakshya" class="image--center mx-auto" /></p>
<h2 id="heading-a-short-video">A short video</h2>
<p>I also prepared a short introduction video for Incubate Nepal showing my passion for computer science. I made this video just a fortnight before my board examination.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/DlcowbqjtzU">https://youtu.be/DlcowbqjtzU</a></div>
<p> </p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I wish I had other things to talk about but these are all of the things that I did in the past 6 months. I have shared almost all the work I did and all of the achievements and learning I had in the first half of the year 2023.</p>
<p>I am also working on a new website at the moment. Truly, I got a chance to reflect on myself and realize what I did in almost 200 days. Looking at my schedule, I wonder how I could have even managed to do all these things but it turns out it was not that difficult at all.</p>
<p>Now, I don't have any exams and am free to do things so I am continuously learning new things. Currently, I am learning about the next js and I wish to learn typescript in the near future. I hope that the near future would in the next few months.</p>
<p>I still have a long list of to-dos and I will make sure I will check all of them out by the end of this year. I specifically didn't have new year's resolution but I had previously mentioned some technologies that I want to learn this year. And definitely, I will do that.</p>
<p>If you read my full article and liked it, we can connect on <a target="_blank" href="https://www.linkedin.com/in/aashishpanthi/">Linkedin</a> and/or <a target="_blank" href="https://twitter.com/aashishpanthi11">Twitter</a>. Thank you for going through this long article about a boring guy.</p>
<p>Bye!👋</p>
]]></content:encoded></item><item><title><![CDATA[My Hashnode AI tools experience]]></title><description><![CDATA[In today's fast-paced tech environment, developers are always on the lookout for cutting-edge tools and platforms to boost their productivity and optimize their workflows. Hashnode, with its advanced AI tools and comprehensive features, has become a ...]]></description><link>https://blog.aashish-panthi.com.np/my-hashnode-ai-tools-experience</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-hashnode-ai-tools-experience</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[AI]]></category><category><![CDATA[Experience ]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Tue, 30 May 2023 05:18:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685423891040/e6ed5812-368f-470e-9f9f-69532ec6e319.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In today's fast-paced tech environment, developers are always on the lookout for cutting-edge tools and platforms to boost their productivity and optimize their workflows. Hashnode, with its advanced AI tools and comprehensive features, has become a popular choice among developers globally. As a developer who has experienced the AI tools provided by Hashnode firsthand, I am eager to share my insights on their transformative impact on my development journey. This article aims to offer an overview of Hashnode's AI tools and explore how they have revolutionized the way developers work and collaborate.</p>
<h2 id="heading-overview-of-hashnode"><strong>Overview of Hashnode</strong></h2>
<p>Before diving into my experience with Hashnode AI tools, it's important to understand the platform's background and the value it brings to developers. Hashnode is a thriving community platform designed explicitly for developers, where they can connect, collaborate, and learn from one another. With a vast and active community of developers, Hashnode fosters an environment that encourages knowledge sharing and growth.</p>
<p>Hashnode, a thriving community platform for developers, offers a user-friendly interface that streamlines publishing and sharing technical content, allowing developers to effortlessly create and customize blogs, share projects and experiences, and engage in meaningful discussions. The platform also integrates seamlessly with popular version control systems like GitHub, making it easy to showcase code repositories.</p>
<p>Moreover, Hashnode provides a range of advanced AI tools, utilizing artificial intelligence, natural language processing, and machine learning to offer intelligent code completion, simplified documentation access, bug detection, and community insights. This combination of a vibrant developer community, intuitive interface, and cutting-edge AI tools makes Hashnode a preferred choice for developers seeking to accelerate growth, collaborate with peers, and stay current with industry trends.</p>
<h2 id="heading-getting-started-with-hashnode-ai">Getting started with Hashnode AI</h2>
<p>So I am very new to hashnode AI but not with AI in general. I was one of the users who got to use the AI feature in beta mode but the past few months were really hectic. I was too busy but looking back on that, I question why I was so busy. But leaving things aside, I accessed Hashnode's AI just yesterday. I didn't subscribe the premium plan instead <mark>I got a 3-day free trial</mark>.</p>
<p>So I wrote one article yesterday about client-side form validation. I heavily used Hashnode's AI in that article. And I am quite excited to share that <strong>I am using Hashnode's AI to share my experience with Hashnode AI.</strong></p>
<h3 id="heading-understanding-key-features">Understanding key features</h3>
<p>So I got a quick tour of how to use Hashnode's AI just after subscribing to it. It was kind of useful, but it wasn't very intense to understand how to use Hashnode's AI. I found three main features:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685419645816/1b477304-7d9c-464a-807d-2e263236cd34.png" alt="three main features of Hashnode AI" class="image--center mx-auto" /></p>
<ul>
<li><p>Generate article outline</p>
</li>
<li><p>Summarize article</p>
</li>
<li><p>Generate code</p>
</li>
</ul>
<p>I thought this was it. But when I selected a few lines of text, I got various other features of Hashnode AI. Yes, I started experimenting with all of the features. I liked many of them but I felt some are just not necessary. Anyways, I will be sharing my personal experience using many features.</p>
<h2 id="heading-writing-and-publishing-articles">Writing and publishing articles</h2>
<h3 id="heading-utilizing-ai-to-generate-an-outline">Utilizing AI to generate an outline</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685419577653/e7bf4925-8ea7-4bb9-934f-5ed701c037b7.png" alt="Using Hashnode's AI to generate an outline" class="image--center mx-auto" /></p>
<p>Most of the time when I think of writing an article, I don't get the topic on which the article is to be written, and when I do, I have a hard time defining the structure of the article. If you look at my previous blogs, you will find without any structured approach, I was writing whatever comes to my mind. So, in my opinion, this particular feature is a game changer.</p>
<h3 id="heading-editing-and-formatting-articles">Editing and formatting articles</h3>
<p>After generating an outline, I have an approach to follow. Now I can write my full article. Then I can use Hashnode AI to polish my article.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685378785706/747ebf21-5957-4052-b13b-2fea3146004e.png" alt="a screenshot of a web page with text" class="image--center mx-auto" /></p>
<p>All I had to do is just select the text, or paragraph of text that I want to polish and I get a <code>Ask AI</code> thing popping up on top which I can click on to get different options. I can now perform tens of operations on that.</p>
<p>For example, I can let AI rewrite the selected portion. Hasnode AI checks and correct my spelling and grammatical errors if exist in that portion. I can simplify the language, or convert it into English if the article is in another language.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685416864297/33e1e774-ebaa-4f13-a992-3724e49d4134.png" alt="Hashnode AI rewrite features" class="image--center mx-auto" /></p>
<p>Similarly, there are other various operations to perform. They are listed as follows:</p>
<ul>
<li><p>Modify -&gt; It helps expansion, summarization, shortening of text, etc.</p>
</li>
<li><p>Tone -&gt; Can change the tone of a particular portion</p>
</li>
<li><p>Transform -&gt; Turn into numbered or bullet list</p>
</li>
</ul>
<p>Also, how can I forget about the alt text generator? But I am not quite happy with it because the alt text generated for the images I have used in this article wasn't satisfactory to me.</p>
<h3 id="heading-publishing-articles">Publishing articles</h3>
<p>It is impressive that the Hashnode team really decided to facilitate the use of AI from start to finish while writing an article. Hashnode AI can now write a blog title, if you are running out of time, it can summarize your article.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685423590107/c205768a-e8e6-4f5b-b88e-7d0ae2180b1d.png" alt class="image--center mx-auto" /></p>
<p>Better, the AI can generate an SEO title and SEO description of the article just before publishing the article. Before this, I used to copy the title of my article and use it as the SEO title and just leave the description blank. And most of the time, I used to leave both fields blank but with this AI, things have changed.</p>
<h2 id="heading-challenges-and-limitations">Challenges and limitations</h2>
<ol>
<li><p>Heading tags convert into normal text, causing no distinction between normal and head tags.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685419707968/ead22b9a-5de0-40e0-9141-5d80f1e3e56a.png" alt class="image--center mx-auto" /></p>
<p> So, I wanted to simplify the highlighted area all at once but when I did that, all of the styling was removed. I like to style the article while writing and proofread it later and polish it. So this problem must be fixed soon.</p>
</li>
<li><p>Limited to correcting grammar or spelling mistakes for only around 100 words, making it difficult to spell-check the entire blog.</p>
<p> %[https://www.youtube.com/watch?v=4kzbkTfr63Y] </p>
</li>
<li><p>Inability to see what was wrong or changed during spelling and grammar checks, only the updated text is visible.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685421670412/256005ae-634c-40a4-9425-b87660bbe3b2.png" alt class="image--center mx-auto" /></p>
<p> In the above screenshot, I am not sure what was really changed. I have to compare both texts myself. Maybe an indicator would greatly make this feature awesome. For example, an underline could be used.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685421784275/40decf96-96a1-4014-ade9-18259308c4f8.png" alt class="image--center mx-auto" /></p>
<p> Difficulty in reading existing text due to pop-up blockades, suggesting Grammarly as a better alternative for saving time.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685421893622/bde9a608-34d1-4b84-9fbf-d7d29391349a.png" alt class="image--center mx-auto" /></p>
<p> In the above example, I cannot even compare the two texts. I appreciate Hashnode team is aware of this. They have tried to minimize this problem and it has worked but not completely eliminated.</p>
</li>
<li><p>Occurrence of styling problems.</p>
<p> I have already mentioned above about this problem but I want to talk more about this in a different scenario: during Expansion. So during the expansion, the AI-generated different topics and explained them below. So I wanted the topics in the form of headings (yes, already styled) but I had to style them as headings individually. The video of this problem is provided below:</p>
<p> %[https://www.youtube.com/watch?v=G1wbFGNPJkM] </p>
</li>
<li><p>Slower performance.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685422520703/e1a6e50f-8146-4a28-be32-b3d0ecc0c93a.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Generated alt text for images being significantly off from the original image, indicating a need for improvement in this area.</p>
</li>
<li><p>I think the AI summarized the article from the reader's perspective, not from the writer's perspective which I think is a problem. Just read the summary below:</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685380122797/af6e03a2-783a-41d8-940d-a8edc69baa31.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<blockquote>
<p>Hashnode AI is a tool that uses artificial intelligence, natural language processing, and machine learning to offer intelligent code completion, simplified documentation access, bug detection, and community insights. This article explores the features of Hashnode AI and how they have revolutionized the way developers work and collaborate, although there are some challenges and limitations.</p>
</blockquote>
<p><strong>Note:</strong> The above summary was also generated using Hashnode AI which I liked the most part about but my inner self is saying me that there is something off.</p>
<p>In conclusion, my experience with Hashnode AI has been quite remarkable, and I eagerly anticipate exploring more features on the final day of the 3-day trial. However, I remain uncertain about whether I will invest in this tool in the future. I kindly request the Hashnode team to address any potential issues, and please feel free to correct me if I have inadvertently misused the tool in any way.</p>
<p>I would like to draw the attention of <a class="user-mention" href="https://hashnode.com/@eleftheriabatsou">Eleftheria Batsou</a> and <a class="user-mention" href="https://hashnode.com/@unclebigbay">Ayodele Samuel Adebayo</a> to look at the challenges I face. Overall, Happy coding.</p>
]]></content:encoded></item><item><title><![CDATA[Client-Side Form Validation Basics]]></title><description><![CDATA[Client-side form validation is a crucial aspect of web development that ensures data integrity and enhances the user experience. In this comprehensive guide, we will explore the ins and outs of client-side form validation using JavaScript. We'll cove...]]></description><link>https://blog.aashish-panthi.com.np/client-side-form-validation-basics</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/client-side-form-validation-basics</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[form validation]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Mon, 29 May 2023 17:10:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685381663127/a02e26ba-d1a1-44af-90aa-c1e00026e913.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Client-side form validation is a crucial aspect of web development that ensures data integrity and enhances the user experience. In this comprehensive guide, we will explore the ins and outs of client-side form validation using JavaScript. We'll cover HTML5 form validation attributes, JavaScript validation methods, regular expressions, accessibility considerations, best practices, and more.</p>
<h2 id="heading-introduction">Introduction</h2>
<h3 id="heading-definition-of-client-side-form-validation">Definition of Client-Side Form Validation</h3>
<p>Client-side form validation refers to the process of validating user input directly in the browser before submitting the form to the server. It allows us to provide instant feedback to users, reducing server load and improving data integrity.</p>
<h3 id="heading-importance-of-client-side-form-validation">Importance of Client-Side Form Validation</h3>
<p>Client-side form validation is essential for creating user-friendly and error-free web forms. It helps prevent invalid data from being submitted, improves the overall user experience, and reduces the server's workload by minimizing unnecessary requests.</p>
<h3 id="heading-comparison-with-server-side-validation">Comparison with Server-Side Validation</h3>
<p>While server-side validation is necessary for ensuring data integrity on the server, client-side form validation has its advantages. It provides real-time feedback to users, minimizing round trips to the server and enhancing the overall responsiveness of the form.</p>
<h2 id="heading-html5-form-validation"><strong>HTML5 Form Validation</strong></h2>
<p>Given the context of comparing client-side validation with server-side validation and the introduction of HTML5 form validation, let's delve deeper into the text and expand upon it to provide more detail and length.</p>
<h3 id="heading-comparison-with-server-side-validation-1">Comparison with server-side validation</h3>
<p>Server-side validation is an essential component of web applications, as it ensures data integrity and security on the server. However, client-side form validation offers some distinct advantages that complement server-side validation. By providing real-time feedback to users as they fill out a form, client-side validation minimizes the number of round trips to the server, which in turn reduces server load and enhances the overall responsiveness and user experience of the form.</p>
<h4 id="heading-html5-form-validation-1">HTML5 Form Validation</h4>
<p>HTML5, the latest iteration of the HTML standard, introduces a variety of built-in form validation attributes that greatly simplify the process of validating user input on the client side. These attributes make it easier for developers to implement client-side validation without relying on complex JavaScript code or third-party libraries. In this section, we will explore some of these attributes and discuss their usage in greater detail.</p>
<ol>
<li><p>Required Attribute: The 'required' attribute can be added to input fields to indicate that a value must be provided before the form can be submitted. This helps ensure that users do not accidentally leave important fields blank.</p>
</li>
<li><p>Pattern Attribute: The 'pattern' attribute allows developers to specify a regular expression that the input value must match in order to be considered valid. This is particularly useful for validating data formats such as email addresses, phone numbers, and postal codes.</p>
</li>
<li><p>Min and Max Attributes: The 'min' and 'max' attributes can be applied to numeric input fields to define the minimum and maximum acceptable values, respectively. These attributes help ensure that users enter values within the desired range.</p>
</li>
<li><p>Step Attribute: The 'step' attribute can be used with numeric input fields to specify the acceptable increments for the input value. This is useful for fields that require values in specific intervals, such as time or date inputs.</p>
</li>
<li><p>Type Attribute: The 'type' attribute can be used to specify the type of data expected in an input field, such as 'email', 'url', 'number', or 'date'. This attribute provides built-in validation for the specified data type, making it easier for developers to ensure that users enter the correct format.</p>
</li>
</ol>
<p>By leveraging these HTML5 form validation attributes, developers can create more user-friendly and responsive forms that provide immediate feedback to users, while still maintaining the necessary server-side validation for data integrity and security.</p>
<h3 id="heading-required"><strong>required</strong></h3>
<p>The <code>required</code> attribute ensures that a field must be filled out before the form can be submitted.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">required</span>&gt;</span>
</code></pre>
<h3 id="heading-pattern"><strong>pattern</strong></h3>
<p>The <code>pattern</code> attribute allows us to specify a regular expression pattern that the input value must match.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">pattern</span>=<span class="hljs-string">"[A-Za-z]+"</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"Only alphabets are allowed"</span>&gt;</span>
</code></pre>
<h3 id="heading-minlength-and-maxlength"><strong>minlength and maxlength</strong></h3>
<p>The <code>minlength</code> and <code>maxlength</code> attributes define the minimum and maximum lengths of the input value.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">minlength</span>=<span class="hljs-string">"6"</span> <span class="hljs-attr">maxlength</span>=<span class="hljs-string">"12"</span>&gt;</span>
</code></pre>
<h3 id="heading-min-and-max"><strong>min and max</strong></h3>
<p>The <code>min</code> and <code>max</code> attributes are used to specify the minimum and maximum values for numeric inputs.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"number"</span> <span class="hljs-attr">min</span>=<span class="hljs-string">"18"</span> <span class="hljs-attr">max</span>=<span class="hljs-string">"99"</span>&gt;</span>
</code></pre>
<h3 id="heading-type"><strong>type</strong></h3>
<p>The <code>type</code> attribute enables specific input validation based on the input type, such as email, URL, date, etc.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"email"</span>&gt;</span>
</code></pre>
<h3 id="heading-custom-validation-messages"><strong>Custom validation messages</strong></h3>
<p>We can customize the validation messages that appear when a field fails validation using the <code>setCustomValidity()</code> method in JavaScript.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">oninvalid</span>=<span class="hljs-string">"setCustomValidity('Please enter a valid name')"</span> <span class="hljs-attr">oninput</span>=<span class="hljs-string">"setCustomValidity('')"</span>&gt;</span>
</code></pre>
<h3 id="heading-styling-invalid-form-elements-with-css"><strong>Styling invalid form elements with CSS</strong></h3>
<p>By leveraging the <code>:invalid</code> and <code>:valid</code> CSS pseudo-classes, we can style invalid form elements to provide visual feedback to users.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">input</span><span class="hljs-selector-pseudo">:invalid</span> {
  <span class="hljs-attribute">border</span>: <span class="hljs-number">2px</span> solid red;
}
</code></pre>
<h2 id="heading-javascript-form-validation"><strong>JavaScript Form Validation</strong></h2>
<p>JavaScript allows for more advanced form validation techniques. Let's explore various aspects of JavaScript-based form validation.</p>
<h3 id="heading-event-handling"><strong>Event handling</strong></h3>
<p>To perform validation, we need to handle form events such as the <code>submit</code> and <code>input</code> events.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> form = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'myForm'</span>);

form.addEventListener(<span class="hljs-string">'submit'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
  event.preventDefault();
  validateForm();
});

form.addEventListener(<span class="hljs-string">'input'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
  validateField(event.target);
});
</code></pre>
<h4 id="heading-submit-event">Submit event</h4>
<p>The <code>submit</code> event is triggered when the form is submitted, either by clicking a submit button or pressing Enter on a form field.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> form = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'myForm'</span>);

form.addEventListener(<span class="hljs-string">'submit'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
  event.preventDefault();
  validateForm();
});
</code></pre>
<p>In the above code, we prevent the default form submission behavior using <code>event.preventDefault()</code> to perform custom validation.</p>
<h4 id="heading-input-event">Input event</h4>
<p>The <code>input</code> event is triggered when the user interacts with an input field, such as typing or pasting text.</p>
<pre><code class="lang-javascript">form.addEventListener(<span class="hljs-string">'input'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>) </span>{
  validateField(event.target);
});
</code></pre>
<p>The <code>input</code> event allows us to validate individual fields as the user enters data, providing real-time feedback.</p>
<h3 id="heading-validation-methods"><strong>Validation methods</strong></h3>
<p>JavaScript provides useful methods for form validation.</p>
<h4 id="heading-checkvalidity">checkValidity()</h4>
<p>The <code>checkValidity()</code> method checks if the form is valid and returns a boolean value.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> form = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'myForm'</span>);
<span class="hljs-keyword">const</span> isValid = form.checkValidity();
</code></pre>
<p>We can use <code>checkValidity()</code> to validate the entire form before submission.</p>
<h4 id="heading-setcustomvalidity">setCustomValidity()</h4>
<p>The <code>setCustomValidity()</code> method allows us to set a custom validation message for a specific form element.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> field = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'name'</span>);

field.setCustomValidity(<span class="hljs-string">'Please enter your name'</span>);
</code></pre>
<p>By calling <code>setCustomValidity()</code> with a custom message, we can provide specific feedback to the user when the field is invalid.</p>
<h3 id="heading-accessing-form-elements"><strong>Accessing form elements</strong></h3>
<p>To perform validation, we need to access form elements.</p>
<h4 id="heading-getelementbyid">getElementById()</h4>
<p>The <code>getElementById()</code> method allows us to access form elements using their unique <code>id</code> attribute.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> username = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'username'</span>).value;
</code></pre>
<p>In the above code, we access the value of an input field with the <code>id</code> attribute of "username".</p>
<h4 id="heading-queryselector">querySelector()</h4>
<p>The <code>querySelector()</code> method enables us to access form elements using CSS selectors.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> email = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'#email'</span>).value;
</code></pre>
<p>Here, we use a CSS selector to access the value of an input field with the <code>id</code> attribute of "email".</p>
<h3 id="heading-displaying-error-messages"><strong>Displaying error messages</strong></h3>
<p>When a form field fails validation, we need to display appropriate error messages to the user.</p>
<h4 id="heading-inserting-elements">Inserting elements</h4>
<p>We can dynamically create error message elements and insert them into the DOM.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> errorDiv = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">'div'</span>);
errorDiv.textContent = <span class="hljs-string">'This field is required'</span>;

<span class="hljs-keyword">const</span> field = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'name'</span>);
field.parentNode.appendChild(errorDiv);
</code></pre>
<p>In the above example, we create a <code>div</code> element, set its text content as the error message, and append it as a child of the field's parent node.</p>
<h4 id="heading-modifying-existing-elements">Modifying existing elements</h4>
<p>Alternatively, we can modify existing elements to display error messages.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> field = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'name'</span>);
field.classList.add(<span class="hljs-string">'error'</span>);
field.setAttribute(<span class="hljs-string">'aria-invalid'</span>, <span class="hljs-string">'true'</span>);
field.setAttribute(<span class="hljs-string">'aria-describedby'</span>, <span class="hljs-string">'name-error'</span>);
</code></pre>
<p>In the code snippet above, we add the <code>error</code> class to the field to apply specific styling and set ARIA attributes to indicate the field's error state.</p>
<p>JavaScript form validation provides flexibility and control in validating form input. By utilizing event handling, validation methods, and accessing form elements, we can create robust form validation experiences for our users.</p>
<h2 id="heading-regular-expressions"><strong>Regular Expressions</strong></h2>
<p>Regular expressions (regex) are powerful patterns used to match and manipulate strings. They play a crucial role in form validation. Personally, I feel regex is complex. Although regex can be complex, you can leverage existing code snippets from the internet to simplify the process, even if you're not familiar with regex.</p>
<h3 id="heading-introduction-to-regular-expressions"><strong>Introduction to regular expressions</strong></h3>
<p>Regular expressions consist of a combination of characters, metacharacters, and quantifiers. They allow you to define patterns that can be used to match and validate specific input formats.</p>
<h3 id="heading-common-patterns-for-form-validation"><strong>Common patterns for form validation</strong></h3>
<p>Here are some common form validation patterns that can be implemented using regular expressions:</p>
<h4 id="heading-email-address">Email address</h4>
<p>Validating an email address is a common use case in form validation. You can use the following code snippet, which utilizes a regex pattern specifically designed for email validation:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> emailRegex = <span class="hljs-regexp">/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/</span>;
<span class="hljs-keyword">const</span> isValidEmail = emailRegex.test(email);
</code></pre>
<p>The <code>emailRegex</code> variable contains the regular expression pattern for validating an email address. The <code>test()</code> method is used to check if the <code>email</code> value matches the pattern.</p>
<h4 id="heading-phone-number">Phone number</h4>
<p>Validating a phone number is another common scenario. Here's an example of a regex pattern for a phone number in the format of XXX-XXX-XXXX:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> phoneRegex = <span class="hljs-regexp">/^\d{3}-\d{3}-\d{4}$/</span>;
<span class="hljs-keyword">const</span> isValidPhone = phoneRegex.test(phoneNumber);
</code></pre>
<p>The <code>phoneRegex</code> variable holds the regular expression pattern, which verifies if the <code>phoneNumber</code> matches the desired format.</p>
<h4 id="heading-password">Password</h4>
<p>Validating password strength is often necessary for user registration or account creation. The following regex pattern ensures the password contains at least one letter, one digit, and is at least eight characters long:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> passwordRegex = <span class="hljs-regexp">/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/</span>;
<span class="hljs-keyword">const</span> isValidPassword = passwordRegex.test(password);
</code></pre>
<p>The <code>passwordRegex</code> the variable contains the regular expression pattern, which checks if the <code>password</code> satisfies the required conditions.</p>
<h3 id="heading-testing-regular-expressions-with-javascript"><strong>Testing regular expressions with JavaScript</strong></h3>
<p>To test regular expressions using JavaScript, you can utilize the <code>test()</code> method available on regex objects. It returns a boolean value indicating whether the provided string matches the regex pattern.</p>
<p>Here's an example of how to use the <code>test()</code> method:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> regex = <span class="hljs-regexp">/^[A-Za-z]+$/</span>;
<span class="hljs-keyword">const</span> isValid = regex.test(inputValue);
</code></pre>
<p>In this example, the <code>regex</code> variable contains a regular expression pattern, and the <code>test()</code> method is used to validate <code>inputValue</code> against that pattern.</p>
<p>Hey there! When working with regular expressions, it's totally okay to borrow code snippets from the internet, especially if you're not super comfortable creating complex regex patterns on your own. Just make sure you get to know the patterns you're using and test them well to make sure they fit your specific form validation needs. Happy coding!</p>
<h2 id="heading-accessibility-considerations"><strong>Accessibility Considerations</strong></h2>
<p>Ensuring accessibility in form validation is crucial to provide an inclusive experience for all users. Let's explore some key aspects of accessible form validation.</p>
<h3 id="heading-importance-of-accessible-forms"><strong>Importance of accessible forms</strong></h3>
<p>Accessible forms ensure that users with disabilities can navigate and interact with them effectively. By following accessibility guidelines, you can make your forms more usable and inclusive for everyone.</p>
<h3 id="heading-aria-attributes-for-form-validation"><strong>ARIA attributes for form validation</strong></h3>
<p>ARIA (Accessible Rich Internet Applications) attributes play a significant role in enhancing the accessibility of form validation. You can use ARIA attributes to provide additional information to assistive technologies and improve the user experience for people with disabilities.</p>
<p>For example, you can use the <code>aria-required</code> attribute to indicate that a field is required for form submission:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">aria-required</span>=<span class="hljs-string">"true"</span>&gt;</span>
</code></pre>
<h3 id="heading-screen-reader-compatibility"><strong>Screen reader compatibility</strong></h3>
<p>When implementing form validation, it's essential to ensure compatibility with screen readers. Screen readers are assistive technologies used by individuals with visual impairments to access web content. By structuring your form elements properly and providing descriptive error messages, you can make your forms more accessible to screen reader users.</p>
<p>To ensure screen reader compatibility, follow these best practices:</p>
<ul>
<li><p>Use semantic HTML elements such as <code>&lt;label&gt;</code> and <code>&lt;fieldset&gt;</code> to provide context and structure to your form.</p>
</li>
<li><p>Associate labels with form controls using the <code>for</code> attribute or by nesting them within the control's parent element.</p>
</li>
<li><p>Use descriptive error messages that clearly indicate the error and provide instructions for correcting it.</p>
</li>
</ul>
<h2 id="heading-best-practices"><strong>Best Practices</strong></h2>
<p>To enhance the effectiveness and usability of client-side form validation, consider following these best practices:</p>
<h3 id="heading-progressive-enhancement"><strong>Progressive enhancement</strong></h3>
<p>Implementing progressive enhancement ensures that even if JavaScript is disabled, server-side validation can still validate the form. By starting with basic HTML5 form validation and enhancing it with JavaScript, you provide a fallback mechanism for users with JavaScript-disabled browsers.</p>
<h3 id="heading-fallback-to-server-side-validation"><strong>Fallback to server-side validation</strong></h3>
<p>While client-side validation provides real-time feedback, server-side validation should always be performed to ensure data integrity. Client-side validation can help improve the user experience, but it's important to perform server-side validation to validate data securely on the server before processing it further.</p>
<h3 id="heading-user-friendly-error-messages"><strong>User-friendly error messages</strong></h3>
<p>Clear and concise error messages help users understand what went wrong and how to correct it. Provide meaningful error messages that describe the issue and offer guidance on how to fix it. Avoid technical jargon and use plain language to ensure users can easily comprehend the error and take appropriate action.</p>
<h3 id="heading-real-time-validation-feedback"><strong>Real-time validation feedback</strong></h3>
<p>Providing real-time validation feedback as users interact with the form can greatly enhance the user experience. Instead of waiting until the form is submitted to display validation errors, validate input on the fly and provide immediate feedback. This approach allows users to correct errors instantly and prevents them from submitting the form with invalid data.</p>
<p>By considering these best practices, you can create more accessible and user-friendly form validation experiences.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In the end, checking forms on the user's side is very important for making websites. We talked about the basics of doing this with JavaScript, like using HTML5 features, JavaScript ways to check, simple codes, making it easy for everyone, and good ideas to follow.</p>
<p>By doing this, you can make your website better for users, keep the information right, and make forms easy to use. Don't forget to also check on the server side for strong and safe checking.</p>
<p>Start using this in your web work now and make your forms better and easier to use. Enjoy coding!</p>
]]></content:encoded></item><item><title><![CDATA[My journey to Burnout Recovery]]></title><description><![CDATA[Procrastination is a very common thing for me but not burnout. The very first time I felt complete burnout was a couple of months ago. It was on July 2022. I am a high school student and I was having a month-long holiday then. Let's go step by step o...]]></description><link>https://blog.aashish-panthi.com.np/my-journey-to-burnout-recovery</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-journey-to-burnout-recovery</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[burnout]]></category><category><![CDATA[procrastination]]></category><category><![CDATA[hackathon]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Wed, 08 Mar 2023 22:41:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1678264102836/daf84db5-13ed-49ce-9f80-f5bad60eae2b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Procrastination is a very common thing for me but not burnout. The very first time I felt complete burnout was a couple of months ago. It was on July 2022. I am a high school student and I was having a month-long holiday then. Let's go step by step on burnout.</p>
<p><img src="https://media3.giphy.com/media/xZsfgxuBCMdLU9I6Hl/giphy.gif?cid=ecf05e47pqgetjz44dudfi6rcuhh1a5l3k0odsmsr81d4l4e&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-i-did-on-holiday">What I did on holiday⚒</h2>
<p>At the start of my holiday, I attended an online hackathon, I built a project. Most of the technologies used in the project were new to me and I had a bit of trouble learning and using them. I have heard many people saying you should use the technologies/languages that you already know in a hackathon but in the case of an online hackathon, things differ, I mean things differ by a large margin.</p>
<p>To better understand the later part of the story, I think you need to understand the context really well. I mean the project which I was making and the technologies I was going to use.</p>
<h2 id="heading-the-project">The project</h2>
<p>I was going to make a price tracker. Initially, I wanted it to be only for Amazon but later on, I tried to diversify it and also use it to track product prices on Flipkart and the stock price on CNBC.</p>
<h3 id="heading-tech-stack">Tech stack 👩‍💻</h3>
<ul>
<li><p><strong>Reactjs</strong> -&gt; For frontend</p>
</li>
<li><p><strong>MongoDB Atlas</strong> -&gt; For MongoDB database</p>
</li>
<li><p><strong>Express.js</strong> -&gt; For API</p>
</li>
<li><p><strong>Linode</strong> -&gt; Deployment</p>
</li>
<li><p><strong>Puppeteer/Cheerio</strong> -&gt; Getting Price</p>
</li>
<li><p><strong>Nodemailer</strong> -&gt; To send email</p>
</li>
</ul>
<h3 id="heading-functions">Functions:</h3>
<p>It checks the price of the product specified. Not only it checks the price, but it also extracts the name and information of the product from the website. It gathers information at regular intervals of fifteen minutes and stores it inside the database. If the current price is found to be less than the specified price by the user then, the user will be updated with an email. And the user can also check the history of the price fluctuation through the nice little dashboard.</p>
<p>I have written a detailed article about it here, <em>I later updated it in December.</em></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/introducing-lootle">https://blog.aashish-panthi.com.np/introducing-lootle</a></div>
<p> </p>
<p>Or there is a short video also.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=R_GvQFZ8CIc">https://www.youtube.com/watch?v=R_GvQFZ8CIc</a></div>
<p> </p>
<h3 id="heading-the-problem">The problem😞</h3>
<p>What was the problem I faced during this hackathon? As I said earlier, I tried out many new technologies and languages during this hackathon. I didn't have much time to learn these things as I had just finished my exams. Yes, I only had like 6 days left for the hackathon. I had to do it all during this time.</p>
<p>I had to learn about web-scraping, using a Linode server to host a MERN application, making a bot that runs automatically in a fixed interval of time, setting up a domain to my app hosted on a Linode Linux server, setting up an email using your domain address and sending an email to update them about the price drop.</p>
<p>Believe each of these things was completely new for me. I already had some knowledge about Linux so the Linux commands didn't freak me out but setting up a domain, DNS configuration, and email setup was a thing that I never tried and I didn't have any knowledge about it.</p>
<h3 id="heading-the-result">The result🏆</h3>
<p>It was a June hackathon, so I was expecting the result in July. Around July 20, I go the result. Guess what, I was among the 5 winners in the hackathon. It was one of the biggest moments for me that has happened to me in my entire life but I wasn't much excited.</p>
<p>By the way, the hackathon was conducted by <a target="_blank" href="https://townhall.hashnode.com/build-with-linode-hackathon-june-2022">Linode and Hashnode</a>, and here is the result of <a target="_blank" href="https://townhall.hashnode.com/linode-x-hashnode-hackathon-winners">the hackathon</a>. I was among the top 5 winners in a total of 60 submissions.</p>
<h1 id="heading-the-burnout">The Burnout😔</h1>
<p>I don't have an absolute idea of what caused burnout but I feel the intense amount of work I had to do in that small amount of time is the reason for the burnout.</p>
<p><img src="https://media2.giphy.com/media/RN96us3MBn569GbElX/giphy.gif?cid=ecf05e47n0qi2oondxl8ic3c1ty3r3f3inknxy12gqkrm3i8&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>I didn't have any interest to learn more. I was spending all my day watching youtube videos and also Facebook videos, surely not the cat videos but other videos. I completely wasted my month-long vacation. I had a long list of things I wanted to do during the month-long vacation but when the vacation ended up.</p>
<p>I didn't realize what was wrong with me. My school reopened, and I started going back to school every day. And after a few days, I sat down and I really had a good talk with myself about what is wrong with me. I noted down all of the things that were happening to me in the hope I could figure out what has happened to me.</p>
<p>After going through the list of problems I curated, I realized that it's the symptoms of burnout.</p>
<h1 id="heading-the-recovery">The recovery💊</h1>
<p>After I found out about the problem, I decided to do something. Of course, I had to do it, right? So, I decided to slowly and steadily. One thing I do most of the time is that I don't jump straight into any problem or solution, I love going slowly into it.</p>
<p>Starting from that day, I reduced my screen time and eventually reduced my screen time. Since I live alone, I started cooking out some really good things, and just started out enjoying every moment. I went and met with some relatives, and spent good times everywhere. I even tried to do better in my studies but this is one thing I fail at every single time. Still, I am trying different ways to resolve these things.</p>
<p>It was just a matter of days and just enjoyment in every single thing I did, I was back at every single thing as I used to be back a month ago.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>Burnout is not a good thing to have. I have had this thing only a single time and I don't want this in my future. As I can't control it but I can surely reduce a lot with the steps I took in the recovery stage onto the prevention stage.</p>
<p>If you have read through this then let me know if you had a similar experience or not. And if you want to know more about my recovery, my DM is always open <a target="_blank" href="https://twitter.com/aashishpanthi11/">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Exploring the e-commerce sites]]></title><description><![CDATA[Today, I want to go to various e-commerce sites out there and extract some information from there like the business models, UI, the sign-in process, and many more. So sit tight and let me take you through all e-commerce giants.
Prerequities📖
I expec...]]></description><link>https://blog.aashish-panthi.com.np/exploring-the-e-commerce-sites</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/exploring-the-e-commerce-sites</guid><category><![CDATA[CocodeBlogs]]></category><category><![CDATA[#cocode]]></category><category><![CDATA[development]]></category><category><![CDATA[e-commerce]]></category><category><![CDATA[business]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Wed, 08 Mar 2023 03:43:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1678246939478/86aa9248-f30f-4325-9313-f7e614591c4f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today, I want to go to various e-commerce sites out there and extract some information from there like the business models, UI, the sign-in process, and many more. So sit tight and let me take you through all e-commerce giants.</p>
<h1 id="heading-prerequities">Prerequities📖</h1>
<p>I expect you to know what e-commerce means and the types of e-commerce business models. If you don't know then let me provide a short description.</p>
<p>E-commerce in its literal sense is just the trade(the process of buying and selling) of goods online. Just like a grocery store or a fashion store situated far from you and you have access to the items at your fingertips.</p>
<p>There are <strong>6 types</strong> of e-commerce business models. And they are:</p>
<ul>
<li><p>Business to Business</p>
</li>
<li><p>Business to Consumer</p>
</li>
<li><p>Consumer to Business</p>
</li>
<li><p>Consumer to Consumer</p>
</li>
<li><p>Consumer to Government</p>
</li>
<li><p>Business to Government</p>
</li>
</ul>
<p>If you want to get detailed information about each of them then I recommend you to visit <a target="_blank" href="https://techykhushi.medium.com/what-are-the-different-types-category-of-e-commerce-or-e-commerce-models-e5945c9754e8">a blog on the medium by Techi Khusi</a>.</p>
<h1 id="heading-let-the-fun-begin">Let the fun begin</h1>
<p>Ok, these are the few companies that I am going to explore today.</p>
<ol>
<li><p><a target="_blank" href="http://Ebay.com">Ebay.com</a></p>
</li>
<li><p><a target="_blank" href="http://Flipcart.com">Flipkart.com</a></p>
</li>
<li><p><a target="_blank" href="http://Snapdeal.com">Snapdeal.com</a></p>
</li>
<li><p><a target="_blank" href="http://daraz.com.np">daraz.com.np</a></p>
</li>
<li><p><a target="_blank" href="http://sastodeal.com">sastodeal.com</a></p>
</li>
<li><p><a target="_blank" href="http://hamrobazaar.com">hamrobazaar.com</a></p>
</li>
<li><p><a target="_blank" href="http://Amazon.com">Amazon.com</a></p>
</li>
<li><p><a target="_blank" href="http://khalti.com.np">khalti.com.np</a></p>
</li>
</ol>
<blockquote>
<p>One thing to note here is that I already have accounts on few of them. So I might miss some process or get biased about them.</p>
</blockquote>
<h2 id="heading-ebay">eBay</h2>
<p>We are starting with eBay. I know it as an online marketplace where one user can list a product and another user can view and order the product if they like it. Let's do some research.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678209766397/3bebbdb0-ead2-416d-b72b-71b7550a85e5.png" alt class="image--center mx-auto" /></p>
<p>I am already greeted with a list of products on the home screen. I haven't used it yet so first I am going to create an account. These are basically the steps that I followed to sign up, buy an item and sell an item.</p>
<center>
<iframe src="https://scribehow.com/embed/How_to_Register_and_List_a_Digital_Good_on_eBay__0aku9n0PSomfW37clSLXrg" width="100%" height="640"></iframe> </center>

<p>I know the sign-up flow was pretty smooth and straightforward forward but the buying process was a little bit tedious. I was greeted with one page after another even though I selected a specific product. Simply put, there were a lot of products.</p>
<p>Since eBay is <strong>C2C (Consumer-to-Consumer)</strong> e-commerce site. So I tried buying up the item. It wasn't much different from any other sites and I even tried to list a product on sale. A lot of fields are to be filled when an item has to be listed. So you need to separate a good amount of time for it, probably more information helps consumers find their actual needs.</p>
<p>And now coming to the UI. It wasn't totally revolutionary. It was good, satisfactory but not excellent to be praisable. Pretty old-school UI is there but with significantly great page load time.</p>
<p>Till now, I think somewhere in your mind you were thinking, I am going to rate the websites but no, I am not going to do that.</p>
<h2 id="heading-flipkart">Flipkart</h2>
<p>Oh boy here comes the neighbor with the never-ending offers on their websites. I have used this website pretty much a lot. No no not for ordering any items but for the learning process. I really admire the UI of this e-commerce site. Just have a look, it is far better than old-fashioned eBay.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678211427562/fdbaa0f3-a02b-4b80-bb67-40176df6c6a1.png" alt class="image--center mx-auto" /></p>
<p>I know it is not completely revolutionary and at the same time, I cannot also say it is worse than eBay. Yes, I might be biased on this as I have already built a price tracker for Flipkart. Do you want to check it out? Well, <a target="_blank" href="https://github.com/aashishpanthi/lootle.live">here it is</a>.</p>
<p>I am quite familiar with the colors and UI but I have never actually tried being a part/member of Flipkart. Today, I want to sign-up on Flipkart.</p>
<center><iframe src="https://scribehow.com/embed/How_to_Create_a_Flipkart_Account__IIn5CLcGTzCRv6hV4v20cQ" width="100%" height="640"></iframe></center>

<p>I tried only creating an account but was unsuccessful because I am just a neighbor. I mean I am in a neighboring country where Flipkart is registered i.e. India. And I wasn't able to change the country code on the mobile number.</p>
<p>Flipkart follows a <strong>B2C(Business-to-Consumer)</strong> e-commerce model. It is one the most popular model out there in the market and the most used one also.</p>
<p>And the ordering process is also pretty smooth. Although I was unable to go through the process as I can't make an account but looking from the outside, it isn't really a pain.</p>
<h2 id="heading-snapdeal">Snapdeal</h2>
<p>I don't know what it is actually for. But as far as I know from some social media posts and videos, it is the same as eBay.</p>
<p>Ok, there is always a first time for doing all things. Here is my first time knowing snap deal and being a member of it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678213141807/f8f94465-4913-45fd-bc51-bfed0aa3159c.png" alt class="image--center mx-auto" /></p>
<p>My genuine first reaction after visiting snapdeal.com was</p>
<p><img src="https://media0.giphy.com/media/OxXxAI6m3LtH55ez27/giphy.gif?cid=ecf05e47xyzz1aevryq6ccyujoqdtzl7dnfb30eo2iwc7drk&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>I am really impressed with the simple user interface. I mean just look at this, it is simple to use, and just feels good to use it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678244224693/a223a8ae-e29f-4f36-a4f9-f9165f4b3485.png" alt class="image--center mx-auto" /></p>
<p>Alright, let's try to use the platform by creating an actual account. That is an actual way to know better about an app.</p>
<center><iframe src="https://scribehow.com/embed/How_to_Register_Mobile_Number_on_Snapdeal__b-ehnaMASzWcTOA2h2yJzQ" width="100%" height="640"></iframe></center>

<p>Yet another only for India product. I can't use my phone number from outside India. Alright, I think it is made only for India. Made in India and only for India product. Good for them.</p>
<p>Moving on, it follows a <strong>C2C(Consumer-to-Consumer)</strong> e-commerce model. So I can actually sell the products in theory but first I have to get an Indian SIM. And the process of selling an item involves slightly different steps than eBay. It is only for India e-commerce sites so to sell the product, you need to have a GST number.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678244947895/3eceabf0-0aba-4e7b-864d-afa032e8ba12.png" alt class="image--center mx-auto" /></p>
<p>Because I am not an Indian. So, let's check out more e-commerce sites.</p>
<h2 id="heading-darazcomnp">Daraz.com.np</h2>
<p>Alright, I used to think that it is an e-commerce model founded and used in Nepal. But no, it was founded in another country, used in different other countries, and registered in another country.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678245116891/34f02c07-0ecf-4afa-94e0-fc320815eb30.png" alt class="image--center mx-auto" /></p>
<p>The e-commerce site I will be visiting is only for my country as it has a specific domain name. It was founded in Pakistan way back in 2012 and is now acquired by one of the e-commerce giants Alibaba a few years ago. Daraz is one of the most popular e-commerce platforms in most south Asian developing countries. Actually, it is now in operation in four countries: Nepal, Pakistan, Bangladesh, and Sri Lanka.</p>
<p>I already have an account on daraz.com.np. So, I am not going to register it again. I can explain the login flow. I was first asked for my email and password and then I filled up more details like the phone number, address, etc. I can be a little biased about it😅</p>
<center>
<iframe src="https://scribehow.com/embed/Buy_product_on_Daraz__XO-DD4Q9SXy_HKFcuIqT2g" width="100%" height="640"></iframe>
</center>

<p>I tried buying one item but this time I faced some issues during the checkout. Overall, the buying process was pretty smooth when I used it in past. I hope it hasn't changed much.</p>
<p>Daraz follows <strong>B2C(Business-to-Consumer)</strong> business model just like Flipkart and amazon. I find the UI of this website quite good except for the hero section, the images, popups, and nav all look like spam to me. And also inner me feels like the loading time of daraz is pretty high compared to the same type of e-commerce sites.</p>
<h1 id="heading-thats-it">That's it</h1>
<p>Alright, we explored a few of the e-commerce sites and will be exploring more in the future. Overall, all of the e-commerce sites basically have the same buying process. And the UI is similar, the only difference there is the color and a little bit of tweaking of elements here and there. And we also realized that some sites are still national and haven't expanded to wide international audiences.</p>
<blockquote>
<p>A little later I got this message from eBay:</p>
<p>"We wanted to let you know that your eBay account has been permanently suspended because of activity that we believe was putting the eBay community at risk. We understand that this must be frustrating, but this decision was not made lightly and it’s important that we keep our marketplace safe for everyone. Learn more about <a target="_blank" href="https://www.ebay.com/help/account/account-holds-restrictions-suspensions/account-holds-restrictions-suspensions?id=4190&amp;mkevt=1&amp;mkdid=4&amp;mkcid=29&amp;bu=45557896034&amp;trkId=129094163005">how and why accounts can be suspended</a>"</p>
<p>Oh gosh, I was just testing out the site. There was absolute no need to ban me premanently.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Debugging through the whole Hackathon]]></title><description><![CDATA[You might find it funny but I was pissed up when I had to debug for absolutely four hours during the hackathon.
Some say debugging is fun, some say it isn't but I say it depends on the situation you are on. Let me share my story of debugging with you...]]></description><link>https://blog.aashish-panthi.com.np/debugging-through-the-whole-hackathon</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/debugging-through-the-whole-hackathon</guid><category><![CDATA[DebuggingFeb]]></category><category><![CDATA[ #DebuggingFeb Writeathon]]></category><category><![CDATA[hackathon]]></category><category><![CDATA[debugging]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Sun, 26 Feb 2023 18:04:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677434514367/8cb2ceae-4734-4e33-98a2-2115ed6198a7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You might find it funny but I was pissed up when I had to debug for absolutely four hours during the hackathon.</p>
<p>Some say debugging is fun, some say it isn't but I say <mark>it depends on the situation you are on.</mark> Let me share my story of debugging with you guys.</p>
<h1 id="heading-how-it-all-started">How it all started?</h1>
<p>So, to attend an offline Hackathon, my friends formed a team and named it <strong>Debugging army</strong>. It was our first Hackathon and we were excited about it, it didn't matter what the name is. The name was chosen by my teammate <a class="user-mention" href="https://hashnode.com/@rajeshkhadka">Rajesh Khadka</a> and during the hackathon, we had regret the name. The reason might seem a bit silly but 2 hours into the hackathon, here we are with the name Debugging Army and got the bug. Actually, the bug arose on my PC, and that too after executing the git pull command.</p>
<h2 id="heading-the-bug">The bug</h2>
<p>The error was saying something on the red text but when I checked it, there was not anything bad as the error mentioned. Yep, that is the worst thing that can happen when you are debugging. And within a couple of hours of getting started on the hackathon, I was struck by a stupid error.</p>
<p>The error was there due to the expo as we were making a mobile application using React Native. Believe me or not, when a web developer tries to make a mobile application he really cries for hours. Yes, I faced it 🐱 Anyways here is the screenshot of the error.</p>
<p><img src="https://media.discordapp.net/attachments/931081933830635620/1065711781495984148/image.png" alt="Image" /></p>
<p>I was getting this error every time I was trying to start my expo app. Yep that shitty <code>expo start</code> command didn't work.</p>
<h1 id="heading-debugging">Debugging</h1>
<p>It is said that a developer spends his maximum time debugging and I realized that things were very well after a couple of hours of getting started in the hackathon.</p>
<p>Why not if I share with you that are the really stupid things I did during the hackathon to resolve this error? First of all, as mentioned in the error, I tried finding the JSON file to resolve the error. So after many unsuccessful attempts, I tried other approaches which I am going to lay down as follows.</p>
<h3 id="heading-deleting-the-files">Deleting the files</h3>
<p>Alright, the very first thing I did was <mark>deleted the node_modules</mark> folder and reinstalled the packages. Since the error looked like this:</p>
<pre><code class="lang-javascript">Starting project at C:\Users\Admire\OneDrive\Documents\Projects\project-dharan\app
<span class="hljs-attr">JsonFileError</span>: <span class="hljs-built_in">Error</span> parsing <span class="hljs-built_in">JSON</span>: 
└─ Cause: <span class="hljs-built_in">SyntaxError</span>: Unexpected token  <span class="hljs-keyword">in</span> <span class="hljs-built_in">JSON</span> at position <span class="hljs-number">0</span>
<span class="hljs-number">1</span> | 
    | ^
JsonFileError: <span class="hljs-built_in">Error</span> parsing <span class="hljs-built_in">JSON</span>: 
└─ Cause: <span class="hljs-built_in">SyntaxError</span>: Unexpected token  <span class="hljs-keyword">in</span> <span class="hljs-built_in">JSON</span> at position <span class="hljs-number">0</span>
<span class="hljs-number">1</span> | 
    | ^
    at parseJsonString (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules@expo\json-file\build\JsonFile.js:<span class="hljs-number">160</span>:<span class="hljs-number">19</span>)
    at <span class="hljs-built_in">Function</span>.readAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules@expo\json-file\build\JsonFile.js:<span class="hljs-number">139</span>:<span class="hljs-number">12</span>)
    at <span class="hljs-keyword">async</span> getPackageVersionAsync
</code></pre>
<p>I thought the error is due to the <code>package.json</code> file so I deleted my project completely from my PC. And then cloned the project from GitHub. I reinstalled all of the dependencies. And all I had to see was the same error. So I tried deleting the project multiple times but it didn't work. Later on, I decided to clone the repository in a separate location and still slammed up by the same error just straight on my face.</p>
<h3 id="heading-deleting-the-expo-globally">Deleting the expo globally</h3>
<p>Yep, I really thought that error might be there because the expo-cli freaked out unnecessarily. So I deleted the expo-cli globally and reinstalled then again ran the very important at the same time the most depressing command and that command is: <em>yes, you guessed it</em></p>
<pre><code class="lang-bash">expo start
</code></pre>
<p>My bad luck was with me this time also. So I decided to get bigger. So now</p>
<h3 id="heading-deleting-the-nodejs">Deleting the Nodejs</h3>
<p>Nothing was working. That's the reason why I uninstalled the node js completely from my PC then installed the latest LTS version which was 18.x then I tried cloning the project again and reinstalling the packages again.</p>
<p><img src="https://media1.giphy.com/media/l4FB4Xvo2ieE9isp2/giphy.gif?cid=ecf05e47nwb3mxztoj18lsc4wvsrofw6db5blanxohbjueep&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>Then I asked my friends which version they were using. They were actually using 16.x so the version wasn't the problem so I reverted back to nodejs 16.x and continued with other ways to resolve the error.</p>
<h3 id="heading-getting-help-from-others">Getting help from others</h3>
<p>Look I was frustrated and tired. Now it was the time to go out, <strong>grab some coffee and chill out</strong>. Just in that time, my friend hopped in to help me out. So I stayed there looking at the ways he is trying to fix the problem. Ok the bug won, he was also unsuccessful to figure out what the error was and what the heck was the source of the error.</p>
<p>It's time to get some help from mentors. There were many mentors out there in hackathons to help anyone out in case they get into any error. So we called for one. We had to wait just a minute and the mentor arrived but with no luck. Well, he was getting late for his home as it was almost midnight so I still had the bug but the mentor left.</p>
<h3 id="heading-changing-the-platform">Changing the platform</h3>
<p>At this time, I was pretty sure that the error I am getting is because of my PC. It wasn't the problem with my teammate's computer. So, I tried to change the environment of my project development.</p>
<p>In short, I download the ubuntu 20.04 LTS ISO and fired it up with Oracle Virtual Box. I set up nodejs and installed the android studio as I was using an android emulator for testing out my mobile application.</p>
<p><img src="https://media4.giphy.com/media/4Zgy9QqzWU8C3ugvCa/giphy.gif?cid=ecf05e47yt1t3sfb5lywt1f86u7qk35m50su733mlqv8dc7n&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>In the meantime, I got another mentor so I handed over my laptop to try his luck. He wasn't confident if he can solve the bug or not. Surely there can't be any expectations to solve any error if you haven't used react-native in past. Still, he tried. The first thing he did was used npm to manage the dependencies of the project. I was using yarn as I had faced really bad problems with npm in past.</p>
<p>He started shooting up different commands to start the project. He even helped me to set up the android device manager for the android emulator on Linux.</p>
<p>Just when we completed setting up the Linux development environment, he fired up the <code>npm start</code> command on the project again. Strangely, <mark>this time it worked</mark>. No, I am not kidding, seriously it worked. My project started and after many hours of struggle, I was finally able to view the app on my phone.</p>
<h1 id="heading-the-struggle">The struggle</h1>
<p>It is still super mysterious and I am still trying to understand why I got the error and what file actually was causing the error. One of the really interesting things I forgot to share here is that my friend asked for the solution to this error on StackOverflow for over 100 bounties.</p>
<p>You can still <a target="_blank" href="https://stackoverflow.com/questions/75177331/unexpected-token-in-json-at-position-0-in-react-native-expo-cli">find the question on StackOverflow</a>. But seriously I am still amazed at how the hell my project started.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>I got to learn a lot of things due to this bug. But everything is not there to learn and you cannot take everything as a good thing. It depends upon the situation. This time I was really stuck for 4 hours during the 24-hour hackathon due to a silly bug that was just mysterious.</p>
<p>In conclusion, the process of debugging can be both challenging and rewarding. While it requires dedication, hard work, and a lot of critical things, the happiness you get after solving the error is on the next level.</p>
<p>Why not end the blog with a good memory? <strong>A photo from the hackathon:</strong></p>
<p><img src="https://lh3.googleusercontent.com/9ZLNIIEMQLtpuKvr3CWv_DTjQg3bid9iyfAPPT1Lj8Me_Q0ZnFU1qNQ0a_KuR9fBFNGwfPDen-4YGiG02Zn8cspU3oM0tBIKF_au5Il9Y9QOPuDDLX0JCnNgVF4426s4AdXDOeSeolZrtxaJYvMkUnNZSahAEtE-naIa_5x3lm9qAJ0gTmq5PJJJiLFK2N7iHUjM2knS5XPCLUSzsyL9QZBc-gI-TiYAo2LvIFs2_NgkCHnIUnxxKqR-NynHcm67qEQhcW3FxQKcc06FFBv3jGkl31RMCxD8TrG5ZmQAG1r3xh09fWB0Oj8EaF1KCTpo3xdkwGCzmgg3v3Kwj5Oc7QQVXOkLmjK0ZuueH3gSkH8k5b22OYIXrEPHUetfXq-xMOYKYCxQakyhsEbxoFQve0kpKMYSZMY5WFBDIy7feuJBEy2m89i7AKyHwdqRdxojcul-02qYa6rDDk_iIZmiMCTGCqk3EspqoegbbUb_2mP3fh9kiVazBvgOd39Wp3rNQEBkg69fL4Fg9flLUO7MTbtoVpAU_WDMko-n_N9mnJIYYPX6_0PpcjqIxeeQ44Jk5Rn1dgPc1XtL1I00vy-0XbPUq-iIrFvYZFt5b4DH9uD9J8UVqdkc4i3l6KLBPmUWOUy7uOAD9dEbu0fwnUMeb95A3ZN0ZX4D1bEyGsrU1dGSsgAGtFMDdbCtMzbsQPzNwRgLAAlcgtuoxwqASsI38lcM1B2b1spLL5wr_K2rGG7AhuJuF-09gJsn6vIJkn45AgHH2VAENLilXNcn1x8i7wqDPf9DxB00YuwDRZATS8QAwdlg_QnPoHhK9lGUUS960v6kNRLpFVu5mXgVUdMX9fSDdbuGhlKioYr41ZFpHczNPJPQlj3M6Gk6iZRH9QHLQZuUoj3v-PgSpMftTjh7_VPtL7UI3IvdpESSJah1Q8Xa=w1920-h944-no?authuser=0" alt /></p>
<p>Let's connect on <a target="_blank" href="https://twitter.com/aashishpanthi11">Twitter</a>. My DMs are always open.</p>
]]></content:encoded></item><item><title><![CDATA[My best community experience]]></title><description><![CDATA[I am not very new to the development field. I have been hacking things out for the last three years. Until now, I have been a part of many offline and online developer communities ranging from the same city to the city on the opposite end of the glob...]]></description><link>https://blog.aashish-panthi.com.np/my-best-community-experience</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-best-community-experience</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[community]]></category><category><![CDATA[Developer Tools]]></category><category><![CDATA[Experience ]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Sat, 25 Feb 2023 16:58:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677339739340/b3c36278-146c-41eb-89d2-c336ec2e1632.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am not very new to the development field. I have been hacking things out for the last three years. Until now, I have been a part of many offline and online developer communities ranging from the same city to the city on the opposite end of the globe.</p>
<p>I have tried different platforms, and also had a conversation with many developers. So let me present to you the communities that I will be part of in the future and also the communities that I don't want to be a part of in the future. Let's start with some good things:</p>
<h2 id="heading-best-communities">Best Communities</h2>
<p>Just straight out of the box, let me present to you the communities that I think being part of is worth it.</p>
<ol>
<li><p>Discord community</p>
</li>
<li><p>Twitter</p>
</li>
<li><p>Instagram design pages</p>
</li>
<li><p>NotJust dev community</p>
</li>
<li><p>Sagarmatha Development Community</p>
</li>
<li><p>ICT club at my school</p>
</li>
</ol>
<p>Now that I mentioned these communities, let me share why I love these communities. And I want to go serially from top to bottom.</p>
<ol>
<li><h3 id="heading-discord-community">Discord Community</h3>
<p> I like discord. I like the fact that it is simple to use and the notification sound that I hear just feels good. I am a part of my communities on discord. Some of the communities are <strong><mark>WeMakeDevs, Hashnode, </mark></strong> <mark><a href="https://hashnode.com/@reactplay" class="user-mention" target="_blank">ReactPlay Blog</a>, </mark> <strong><mark>Appwrite.</mark></strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677342051485/afd0ad38-8f6d-414f-a022-223f5243c14e.png" alt class="image--center mx-auto" /></p>
<p> You may ask what is so special about discord. There are other platforms too like Reddit. My answer to that is yes there are platforms like Reddit but the friendliness I have with discord is on the next level. The fact that you have a bot integrated, you have voice channels, and you have different channels inside of a single server. These all are quite a few reasons.</p>
<p> Not only that, but I have also helped and taken help from a few other discord users who are also developers.</p>
</li>
<li><h3 id="heading-twitter">Twitter</h3>
<p> One thing to note is that Twitter is not only for politicians to make announcements or for celebrities to spread controversies, it is also a platform that has helped many developers grow in their life. On Twitter, I have the freedom to ask anything to any developer that can be an intern of MAANG or a senior developer of a startup next door with just one tweet.</p>
<p> I can follow my role models, reach out to them if I need some assistance, or can ask them for referrals to get my new job. Also, Randal Kanna mentioned in her book Standout Developer how she got a boost from Twitter. If you want to check it out, <a target="_blank" href="https://randallkanna.com/the-standout-developer/">here it is</a></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677342712900/f67e21fe-1d36-4d4d-b448-89df19ccf150.png" alt class="image--center mx-auto" /></p>
<p> Not going to lie, one of the reasons why I am on Twitter is because of Elon, and another because of the free tips and resources that are being served on Twitter thread for free.</p>
</li>
<li><h3 id="heading-instagram-design-pages">Instagram Design Pages</h3>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677342987047/94e91bb8-006e-40a5-9cc4-b68e15118e5e.png" alt class="image--center mx-auto" /></p>
<p> While you don't talk a lot on those pages but you really get inspired by those designs that are sick. Yep, I get jealous of the designs there is more that I learn. Yet I think I can improve a bit by continuously following some UI/UX tips from those talented designers.</p>
</li>
<li><h3 id="heading-notjust-dev-community">NotJust dev community</h3>
<p> It is more of a closed community that you get access to once you buy one of the courses from NotJust Academy. And a quick disclaimer <em>I have not purchased any courses and I don't motivate or influence you to buy one. I have go the course as a prize.</em></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677343141730/53c0e375-c2ca-4874-b7b5-7b871a5df57d.png" alt class="image--center mx-auto" /></p>
<p> You can ask any questions about mobile application development using React Native and the community will help you out.</p>
</li>
<li><h3 id="heading-sagarmatha-developer-community">Sagarmatha Developer Community</h3>
<p> Sometimes when you talk with folks outside of your country, they don't know about the market condition near you. What are the technologies that are being used around you also don't have connections to get a quick job near you live, so it is always better to have a local/national community of developers that know each other better.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677343417898/95d636d1-72fa-43fb-b2c2-71f2cac11c98.png" alt class="image--center mx-auto" /></p>
<p> This group has helped me a lot in the past and I am sure this will help me in a near future also.</p>
</li>
<li><h3 id="heading-ict-club-at-my-school">ICT club at my School</h3>
<p> While it is good to have a local/national developer community but nothing can be compared to a physical group of nerds like you roaming around and organizing events. So we have a club in our school and I feel great to be a part of it. In the past also, we have organized some events and in the future also we have big plans</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677343766546/6d044ab5-2eda-45a5-8a9a-8977608212c8.png" alt class="image--center mx-auto" /></p>
<p> Just feels great to be part of the journey to make changes in so many lives of the locals. And it is one of my best offline developer communities.</p>
</li>
</ol>
<h2 id="heading-worst-communities">Worst communities</h2>
<p>I think it is common to disagree with certain views of some communities. And there can be an instance where you might not be happy but in my case, there is one community that I never feel is a very good one. To be very real, I cut off my relations with the community <em>where I used to be a member.</em></p>
<p>And ladies and gentlemen, that community is Facebook groups. I don't think there is any point in joining those communities. At the end of the day, you will see posts full of promotions of a blog post or youtube channels that fill up your news feed. And sometimes people start throwing words at each other.</p>
<p>Yes, I am biased. I am not so big fan of Facebook. And I don't think I will be in near future. But the thing that happens in the developer group on Facebook is shit on a whole new level.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The communities I mentioned above have played a crucial role in my life and they have shaped me to be the one that I am today. I hope I will be an active member of these communities and want to contribute to these developer communities as much as possible. But if I have to pick the best community out of the communities I have discussed above it will be non-other than the <strong>discord family</strong>. And the servers I am part of.</p>
<p>As we know Twitter is a great place for developers too. So <a target="_blank" href="https://twitter.com/aashishpanthi11">let's have a chitchat</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Just debugging and debugging]]></title><description><![CDATA[Hi there, wanna know who is writing this blog?
Oh look, it's a frustrated developer.  Tired of debugging the whole day now saw an announcement from Hashnode Townhall.
Yes, it's me. And I was frustrated the whole day and still, I am and in this frustr...]]></description><link>https://blog.aashish-panthi.com.np/just-debugging-and-debugging</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/just-debugging-and-debugging</guid><category><![CDATA[DebuggingFeb]]></category><category><![CDATA[debugging]]></category><category><![CDATA[C#]]></category><category><![CDATA[React]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Mon, 13 Feb 2023 12:50:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1676292563335/1b1c6402-6a70-4a84-a4d2-7ae6abeadd19.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi there, wanna know who is writing this blog?</p>
<p>Oh look, it's a <mark>frustrated developer. </mark> Tired of debugging the whole day now saw an announcement from Hashnode Townhall.</p>
<p>Yes, it's me. And I was frustrated the whole day and still, I am and in this frustration, I don't know if I will be funny or just throw up some garbage about programming. Anything can happen, but before that let me give you an idea of why I am so frustrated.</p>
<h2 id="heading-the-context">The context</h2>
<p>Look, I have made an API using c#. And before you make a meme out of me for using c# ko make an API. Please let me inform you that I know and I can make a REST API using nodejs and express. So there is a reason why I chose c# for the API. It was my assignment to use c# and make something out of it. Being very lazy and clever, I thought making an API would be very easy to do.</p>
<p>If you have made an API using c#, I feel sorry for you. And you should also feel the same for me😥. Please.</p>
<p>I didn't know heck many things are involved in making a REST API using c#. First of all connect it to a database, which is a nightmare in itself. And second of all, I need to test it out. I wonder if there would be something that would automatically correct my program's bug before I test. <mark>Encountering a bug in a code is really painful, trust me😅</mark> And especially when you don't know that is the reason, then it gets juicy.</p>
<h2 id="heading-debugging">Debugging</h2>
<p>Welcome to the most confusing word of my life after being a developer cause I don't know when I hear this word if I need to be sad or get excited. Debugging is really that pain <strong>that</strong> you can't get rid of and that you also don't want at the same time. But our loved god just likes to drop it in our career and if it is a coincidence or not, there is literally a gap of 5 minutes between two moments: <strong>the bug is resolved,</strong> and <strong>shit, another one.</strong></p>
<p>Also when the bug is resolved, you really get happiness on another level. And god, this debugging thing really teaches me the things that I never learned in my programming class and not even on youtube from an Indian guy.</p>
<h3 id="heading-my-pain">My pain 😨</h3>
<p>Ok, I can't still get out of it. So, allow me to throw all of my pain here. Somehow, I managed to make the API and but when I tried to host it creating a droplet on digitalocean, I got million other errors. And again when I successfully deployed it, I of course needed a frontend to do the request. GET request worked, but POST didn't. I want to be a kind guy, but the words I got in my mind, I just can't write them up here.</p>
<h3 id="heading-the-present-pain">The present pain🥱</h3>
<p>Yes, I am still in pain. In fact, the intensity is much higher. Yesterday, I slept in a chill thing my project is done. Yes, I completed the front end and hosted it successfully using netlify. And my friend <a class="user-mention" href="https://hashnode.com/@rajeshkhadka">Rajesh Khadka</a> asked me to provide a URL of my app to try out. I gave him and he told me things are not working well.</p>
<p>Inside of my brain, there was a red alarm that was ringing just like the red alarm⏰ that buzzed on Google Headquarters after the success of chatGPT. So leaving my all other work aside, I jumped right into it. And it is dark now. Meaning it's evening and I am debugging from the morning. Oh hell, I spent more than 10 hours and still I am getting more and more new bugs.</p>
<p>I hate those bugs but to name some</p>
<ul>
<li><p>CORS error</p>
</li>
<li><p>API endpoint mismatch error</p>
</li>
<li><p>UI not being refreshed error</p>
</li>
<li><p>If your front end has https, you can't request HTTP. Yes, that's also a bug in my app.</p>
</li>
<li><p>Unknown bug</p>
</li>
<li><p>Unnamed bug</p>
</li>
</ul>
<p>and many more.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I would have written the conclusion but my boy I need to go debug. Who knows I might resolve those things now🤷‍♂️.</p>
<p><strong>Bye</strong></p>
]]></content:encoded></item><item><title><![CDATA[Form Validation with Joi]]></title><description><![CDATA[Validating form values is an important step in ensuring the integrity and accuracy of the data being collected. One popular tool for this task is Joi, a JavaScript object schema validation library. With Joi, you can define a schema for your form valu...]]></description><link>https://blog.aashish-panthi.com.np/form-validation-with-joi</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/form-validation-with-joi</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[Validation]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[joi]]></category><category><![CDATA[development]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Mon, 30 Jan 2023 12:27:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675081476646/0c990d29-8ab0-4c41-97e0-f3544a839765.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Validating form values is an important step in ensuring the integrity and accuracy of the data being collected. One popular tool for this task is Joi, a JavaScript object schema validation library. With Joi, you can define a schema for your form values and then validate user input against that schema.</p>
<p>To use Joi, you first need to install it using npm:</p>
<p><code>npm install joi</code></p>
<h2 id="heading-schema">Schema</h2>
<p>Once installed, you can import Joi into your JavaScript code and use it to define a schema for your form values. For example, if your form has a field for a user's name, you could define a schema that requires the value to be a non-empty string:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Joi =<span class="hljs-built_in">require</span>(<span class="hljs-string">'joi'</span>);

<span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">name</span>: Joi.string().required()
});
</code></pre>
<h2 id="heading-validation">Validation</h2>
<p>You can then use the schema to validate user input. For example, the following code checks if the user's input for the name field is valid according to the schema:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { error } = schema.validate({<span class="hljs-attr">name</span>:<span class="hljs-string">'John Doe'</span>});

<span class="hljs-keyword">if</span>(error){
    <span class="hljs-comment">// The user's input for the name field is not valid</span>
}
</code></pre>
<p>Joi offers a wide range of options for defining and validating your form values. For example, you can specify the minimum and maximum length of a string, the minimum and maximum value of a number, or the presence of specific characters in a string. You can also specify that certain fields are required, or that they must match a specific pattern.</p>
<h2 id="heading-required">Required</h2>
<p>You can make an email required as follows:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">email</span>: Joi.string().required()
});
</code></pre>
<p>Of course, you need to validate it afterward as we did above. Let's just see the code anyways.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { error } = schema.validate({<span class="hljs-attr">email</span>:<span class="hljs-string">'john@example.com'</span>});

<span class="hljs-keyword">if</span>(error){
    <span class="hljs-comment">// The user's input for the email field is not valid</span>
}
</code></pre>
<h2 id="heading-optional">Optional</h2>
<p>o specify that a field is optional in a Joi schema, you can use the <code>optional</code> method. This method allows a value to be either provided or left undefined.</p>
<p>For example, if your form has a field for a user's phone number, you could define a schema that allows the value to be either a string or undefined:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">phone</span>: Joi.string().optional()
});
</code></pre>
<p>You can then use the schema to validate user input. For example, the following code checks if the user's input for the phone field is valid according to the schema:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { error } = schema.validate({<span class="hljs-attr">phone</span>:<span class="hljs-string">'123-456-7890'</span>});

<span class="hljs-keyword">if</span>(error){
    <span class="hljs-comment">// The user's input for the phone field is not valid</span>
}
</code></pre>
<p>If the user does not provide a value for the phone field, the validation will still pass, since the field is optional according to the schema.</p>
<p>In addition to the <code>optional</code> method, Joi also provides the <code>allow</code> method, which allows you to specify a list of specific values that are considered valid for an optional field. For example, you could use the <code>allow</code> method to specify that an optional field can only be <code>null</code> or <code>undefined</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">phone</span>: Joi.string().allow(<span class="hljs-literal">null</span>,<span class="hljs-literal">undefined</span>)
});
</code></pre>
<p>This can be useful for cases where you want to explicitly differentiate between a field that has been left empty and a field that has been explicitly set to a null or undefined value.</p>
<h2 id="heading-min-and-max">Min and max</h2>
<p>To specify a minimum or maximum value for a field in a Joi schema, you can use the <code>min</code> and <code>max</code> methods. These methods allow you to specify the minimum and maximum allowed values for a field, respectively.</p>
<p>For example, if your form has a field for a user's age, you could define a schema that requires the value to be a number between 18 and 99:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">age</span>: Joi.number().min(<span class="hljs-number">18</span>).max(<span class="hljs-number">99</span>)
});
</code></pre>
<p>You can then use the schema to validate user input. For example, the following code checks if the user's input for the age field is valid according to the schema:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { error } = schema.validate({<span class="hljs-attr">age</span>:<span class="hljs-number">25</span>});

<span class="hljs-keyword">if</span>(error){
    <span class="hljs-comment">// The user's input for the age field is not valid</span>
}
</code></pre>
<p>In addition to the <code>min</code> and <code>max</code> methods, Joi also provides the <code>greater</code> and <code>less</code> methods, which allow you to specify a minimum or maximum value, respectively, that a field must be strictly greater or less than.</p>
<p>For example, you could use the <code>greater</code> and <code>less</code> methods to specify that a field must be a number strictly greater than 0 and strictly less than 100:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">age</span>: Joi.number().greater(<span class="hljs-number">0</span>).less(<span class="hljs-number">100</span>)
});
</code></pre>
<p>These methods can be useful for defining more precise and specific constraints on the values allowed for a field in your form.</p>
<h2 id="heading-check-the-presence-of-specific-character">Check the presence of specific character</h2>
<p>To check for the presence of specific characters in a string field in a Joi schema, you can use the <code>regex</code> method. This method allows you to specify a regular expression that the value must match in order to be considered valid.</p>
<p>For example, if your form has a field for a user's password, you could define a schema that requires the value to contain at least one lowercase letter, one uppercase letter, and one number:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> schema = Joi.object({
    <span class="hljs-attr">password</span>: Joi.string().regex(<span class="hljs-regexp">/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/</span>)
});
</code></pre>
<p>You can then use the schema to validate user input. For example, the following code checks if the user's input for the password field is valid according to the schema:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span>{ error }= schema.validate({<span class="hljs-attr">password</span>:<span class="hljs-string">'p@ssw0rd'</span>});

<span class="hljs-keyword">if</span>(error){
    <span class="hljs-comment">// The user's input for the password field is not valid</span>
}
</code></pre>
<p>The <code>regex</code> a method is a powerful tool for defining complex constraints on the values allowed for a field in your form. You can use it to check for the presence of specific characters, patterns, or combinations of characters in a string value.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>By using Joi to validate your form values, you can ensure that the data you collect is accurate and reliable. This can be especially important when working with sensitive data, such as personal information or financial transactions.</p>
]]></content:encoded></item><item><title><![CDATA[The advantages of using a version control system]]></title><description><![CDATA[As a web developer, staying organized and keeping track of changes to your code is essential to ensure that your projects run smoothly. One tool that can help with this is a version control system, such as Git.
Git
Git is a free, open-source version ...]]></description><link>https://blog.aashish-panthi.com.np/the-advantages-of-using-a-version-control-system</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/the-advantages-of-using-a-version-control-system</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[development]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[version control]]></category><category><![CDATA[Git]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Sat, 28 Jan 2023 06:06:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674885787134/620666d8-67ca-438a-a9ef-19ff377aa668.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As a web developer, staying organized and keeping track of changes to your code is essential to ensure that your projects run smoothly. One tool that can help with this is a version control system, such as <strong>Git</strong>.</p>
<h2 id="heading-git">Git</h2>
<p>Git is a free, open-source version control system that allows you to save different versions of your code and track changes. This means you can easily revert to previous versions of your code if something goes wrong, or collaborate with other developers on a project.</p>
<h3 id="heading-why-git">Why Git?</h3>
<p>One of the main advantages of using Git is that it allows you to work on multiple branches of your code at the same time. For example, you can work on a new feature in one branch, while another developer works on a bug fix in another branch. These branches can then be merged together when they are ready, without affecting the rest of the code. This allows for a flexible and efficient workflow, as multiple team members can work on different aspects of a project simultaneously.</p>
<p>Another advantage of using Git is that it allows you to collaborate with other developers on a project. You can share your code with others and easily merge their changes into your code. This makes it easy for teams of developers to work together on a project, and reduces the risk of conflicts or overwriting each other's work. Git also enables developers to review each other's code and provide feedback, making it a valuable tool for code review and quality assurance.</p>
<p>Git also allows you to save different versions of your code, so you can easily roll back to a previous version if something goes wrong. This is particularly useful when working on large projects, where it can be difficult to keep track of changes. Git also allows you to see the history of the changes that were made, who made them and when. This enables developers to understand how the codebase progressed over time and fix issues that may have happened in the past.</p>
<p>Using Git also allows you to make use of a remote repository, such as GitHub, GitLab, and Bitbucket. This enables you to store your code remotely and access it from anywhere, making it easier to collaborate with other developers and share your work with others. This also allows for backup and disaster recovery in case something happens to the local copies of your code.</p>
<p>Another great feature of Git is its ability to handle merge conflicts. Merge conflicts can occur when two different branches of code are merged together and there are changes in the same lines of code. Git will automatically detect these conflicts and prompt the developer to resolve them. This can be done by manually editing the code or by using Git's built-in merge tool. This process may seem daunting at first, but with practice, it becomes a straightforward task.</p>
<p>In addition to these features, Git also offers a wide range of plugins and integrations that can be used to enhance its functionality. For example, you can use Git hooks to automate tasks such as running tests or deploying code to a live server. You can also use Git with various IDEs and text editors, such as Visual Studio Code, Sublime Text, and Atom, to make your workflow even more efficient.</p>
<p>Furthermore, Git is widely used in the open-source community. This means that as a web developer, you have access to a large number of open-source projects that you can use and contribute to. This can be a great way to learn and improve your skills, as well as to give back to the community.</p>
<p>One important thing to keep in mind when using Git is the importance of good commit messages. A good commit message should be clear, concise, and informative. It should explain what changes were made and why. This can be especially helpful when working in a team or when reviewing code.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In summary, Git is an incredibly powerful tool for web developers that can help to improve organization, collaboration, and efficiency in your projects. With its ability to track changes, work on multiple branches, and handle merge conflicts, Git can streamline your workflow and make it easier to manage your code. Additionally, the ability to use remote repositories and access a wide range of plugins and integrations can enhance your productivity and make it easier to share your work with others. And with its widespread use in the open-source community, you have the opportunity to learn and contribute to a wide range of projects. By taking the time to learn and master Git, you can take your skills as a web developer to the next level.</p>
]]></content:encoded></item><item><title><![CDATA[My Year in Review: Reflecting on My Journey as a Developer in 2022]]></title><description><![CDATA[It's the end of the year, and as a developer, it's a great time to reflect on the progress I've made and the things I've learned over the past 12 months.
I'm Aashish Panthi, and 2022 was my third year in development, but my first year as a serious de...]]></description><link>https://blog.aashish-panthi.com.np/my-year-in-review-reflecting-on-my-journey-as-a-developer-in-2022</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-year-in-review-reflecting-on-my-journey-as-a-developer-in-2022</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[yearinreview]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Fri, 27 Jan 2023 16:36:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674837364293/90f5dc89-fa03-4f21-860a-cec0b7891745.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the end of the year, and as a developer, it's a great time to reflect on the progress I've made and the things I've learned over the past 12 months.</p>
<p>I'm Aashish Panthi, and 2022 was my third year in development, but my first year as a serious developer. This year was a whirlwind of new experiences and growth for me, and I'm excited to share my journey with you in this blog post.</p>
<h2 id="heading-my-open-source-contributions"><strong>My Open-Source Contributions</strong></h2>
<p>To start, 2022 was the most productive year as a developer for me. I made more than 1,000 contributions to open-source projects, and I learned how to open issues, create pull requests, and even merge pull requests. Overall, I learned how to contribute to open-source projects in a meaningful way.</p>
<p>One of the highlights of my open-source journey this year was participating in my first Hacktoberfest. For those who don't know, Hacktoberfest is a month-long celebration of open-source contributions, and it's a great way to get involved with open-source projects and learn new skills. I was thrilled to see my contributions spike in October, and I'm already looking forward to participating in Hacktoberfest again next year.</p>
<h2 id="heading-my-learnings-in-2022"><strong>My Learnings in 2022</strong></h2>
<p>This year, I dove headfirst into the world of programming and learned a wide variety of new technologies. I started experimenting with markup languages like HTML and CSS, and then moved on to high-level programming languages like JavaScript and Python. I also learned about cloud computing and the importance of using free services to avoid surprise billing.</p>
<p>I also gained experience with open-source projects by both using them in my projects and contributing to them. And I started creating videos for the community to share my knowledge and help others learn.</p>
<p>Looking back on the year, I feel like I've come a long way. I've added a lot of new technologies to my skillset, and I've got even more on my bucket list for 2023.</p>
<h2 id="heading-my-first-hackathons"><strong>My First Hackathons</strong></h2>
<p>As a serious developer, I knew that I wanted to challenge myself and learn new technologies by participating in hackathons. I took part in more than 15 online hackathons this year and won quite a few prizes. I even became a winner of one of the hackathons organized by Hashnode, and I was the runner-up in another one.</p>
<p>Participating in hackathons was a great learning experience for me. I had to think quickly and work efficiently to develop a solution to a problem in a short amount of time. I also had the opportunity to work with new technologies and collaborate with other developers.</p>
<h2 id="heading-my-projects-in-2022"><strong>My Projects in 2022</strong></h2>
<p>This year, I built a lot of projects, and I'm most excited to share my experience building two mobile applications. Prior to this year, I had no experience with mobile app development, but I took the fear out of me and developed two mobile applications.</p>
<p>Here's a list of my projects, organized by the date of creation:</p>
<table><tbody><tr><td><p><strong>S.N.</strong></p></td><td><p><strong>Name</strong></p></td><td><p><strong>Type</strong></p></td><td><p><strong>Description</strong></p></td><td><p><strong>Source code</strong></p></td><td><p><strong>Demo link</strong></p></td></tr><tr><td><p>1.</p></td><td><p>Hostque</p></td><td><p>website</p></td><td><p>A web template for cloud hosting provider.</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/hostque"><strong>github.com/aashishpanthi/hostque</strong></a></p></td><td><p><a target="_blank" href="http://hostque.netlify.app"><strong>hostque.netlify.app</strong></a></p></td></tr><tr><td><p>2.</p></td><td><p>NFTque</p></td><td><p>website</p></td><td><p>A NFT marketplace</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/NFTque"><strong>github.com/aashishpanthi/NFTque</strong></a></p></td><td><p><a target="_blank" href="http://nftque.netlify.app"><strong>nftque.netlify.app</strong></a></p></td></tr><tr><td><p>3.</p></td><td><p>Samjhana</p></td><td><p>website</p></td><td><p>A place to write your last wish and fulfill others</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/samjhana"><strong>github.com/aashishpanthi/samjhana</strong></a></p></td><td><p><a target="_blank" href="http://samjhana.netlify.app"><strong>samjhana.netlify.app</strong></a></p></td></tr><tr><td><p>4.</p></td><td><p>Codyper</p></td><td><p>website</p></td><td><p>Learn programming while typing or vice-versa</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/codyper"><strong>github.com/aashishpanthi/codyper</strong></a></p></td><td><p><a target="_blank" href="http://codyper.netlify.app"><strong>codyper.netlify.app</strong></a></p></td></tr><tr><td><p>5.</p></td><td><p>Attende</p></td><td><p>Mobile application</p></td><td><p>A mobile application for attendance taking</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/attende"><strong>github.com/aashishpanthi/attende</strong></a></p></td><td><p><a target="_blank" href="http://expo.dev/@aashishpanthi/attende"><strong>expo.dev/@aashishpanthi/attende</strong></a></p></td></tr><tr><td><p>6.</p></td><td><p>Lootle</p></td><td><p>website</p></td><td><p>Track price of your product or stock</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/lootle.live"><strong>github.com/aashishpanthi/lootle.live</strong></a></p></td><td><p><a target="_blank" href="http://lootle.live"><strong>lootle.live</strong></a></p></td></tr><tr><td><p>7.</p></td><td><p>Juhu</p></td><td><p>website</p></td><td><p>Search Engine</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/search-engine"><strong>github.com/aashishpanthi/search-engine</strong></a></p></td><td><p><a target="_blank" href="http://juhu.live"><strong>juhu.live</strong></a></p></td></tr><tr><td><p>8.</p></td><td><p>GitHub Lines of Code</p></td><td><p>website</p></td><td><p>Generate a dev card with the number of lines of code you have written</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/github-lines-of-code"><strong>github.com/aashishpanthi/github-lines-of-code</strong></a></p></td><td><p><a target="_blank" href="http://dev.d35hk11gzwtpyz.amplifyapp.com"><strong>dev.d35hk11gzwtpyz.amplifyapp.com</strong></a></p></td></tr><tr><td><p>9.</p></td><td><p>Hamro Earth</p></td><td><p>website</p></td><td><p>Track International Space station in 3D</p></td><td><p><a target="_blank" href="http://github.com/saroj-regmi/Nasa-space"><strong>github.com/saroj-regmi/Nasa-space</strong></a></p></td><td><p><a target="_blank" href="http://hamro.earth"><strong>hamro.earth</strong></a></p></td></tr><tr><td><p>10.</p></td><td><p>Mailsbe</p></td><td><p>website</p></td><td><p>Know if your email was read or not</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/mailsbe"><strong>github.com/aashishpanthi/mailsbe</strong></a></p></td><td><p><a target="_blank" href="http://mailsbe.netlify.app"><strong>mailsbe.netlify.app</strong></a></p></td></tr><tr><td><p>11.</p></td><td><p>FIFA World Cup update</p></td><td><p>mobile application</p></td><td><p>A mobile app that gives you updates of world cup 2022 match</p></td><td><p><a target="_blank" href="http://github.com/aashishpanthi/FIFA-World-Cup"><strong>github.com/aashishpanthi/FIFA-World-Cup</strong></a></p></td><td><p><a target="_blank" href="http://expo.dev/@aashishpanthi/FIFA-World-Cup-2022"><strong>expo.dev/@aashishpanthi/FIFA-World-Cup-2022</strong></a></p></td></tr><tr><td><p>12.</p></td><td><p>Double vote prevention system</p></td><td><p>hardware project</p></td><td><p>Voting fraud prevention using Arduino</p></td><td><p></p></td><td><p></p></td></tr></tbody></table>

<p>Among these,</p>
<ul>
<li><p>I faced the most issues in mobile application development.</p>
</li>
<li><p>I got stuck for a longer time during the Hardware project.</p>
</li>
<li><p>The most amount of mental pressure I put on was over Search Engine.</p>
</li>
<li><p>The projects that are very useful and working perfectly fine are lootle and mailsbe.</p>
</li>
</ul>
<p>In conclusion, it's important to keep track of your projects and organize them in a way that makes sense for you. Whether it's by date of creation, type of project, or any other method, having a clear system in place can help you stay on top of your work and easily reference past projects. Additionally, sharing your projects with others can not only showcase your skills and accomplishments but also potentially lead to new opportunities or collaborations. Overall, taking the time to document and organize your projects is a valuable investment in your professional development.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>The thing which I am the proudest about in 2022 is doing good projects and learning from them. Also, joining developer communities, asking questions, and answering some questions there was very effective for me to grow as a developer.</p>
]]></content:encoded></item><item><title><![CDATA[My opensource contributions]]></title><description><![CDATA[Before diving into my personal story of open-source contribution. Let me get you all on the same page.
What is an open source?
"Open source refers to a type of software that is released under a license that allows the source code to be freely accesse...]]></description><link>https://blog.aashish-panthi.com.np/my-opensource-contributions</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-opensource-contributions</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[BlogsWithCC]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Wed, 25 Jan 2023 01:54:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674611571253/18fc9ead-f393-4c15-bbb0-71971d89fabd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Before diving into my personal story of open-source contribution. Let me get you all on the same page.</p>
<h2 id="heading-what-is-an-open-source">What is an open source?</h2>
<p>"Open source refers to a type of software that is released under a license that allows the source code to be freely accessed, used, and modified by anyone. This means that anyone can view, modify, and distribute the source code for an open source software program, as long as they follow the terms of the license."</p>
<p>If you currently search on google, you will find the definition filled with technical words as above. If I have to explain it. Then I would explain open source like this:</p>
<p>An open source is a project/software whose source code is public and you can use that code to learn, customize and earn without getting into trouble. By trouble, I mean legal trouble.</p>
<h2 id="heading-why-should-we-contribute-to-open-source">Why should we contribute to open source?</h2>
<p>There are a number of reasons why you might want to contribute to open-source projects. For one, contributing to open source can be a rewarding and fulfilling experience, as it allows you to contribute to projects that are important to you and make a positive impact on the world.</p>
<p>Additionally, contributing to open source can also be a great way to learn and develop new skills. By collaborating with other volunteers on open source projects, you can learn from their expertise and experience, and gain valuable knowledge and experience in areas such as software development, project management, and collaboration.</p>
<p>Another reason to contribute to open source is that it can help to build your professional reputation and network. Many open source projects are highly visible and well-respected in the tech industry, and participating in these projects can help to showcase your skills and expertise to potential employers and colleagues.</p>
<p>Furthermore, contributing to open source can also provide opportunities for professional growth and advancement. Many open source projects offer leadership and mentorship opportunities, which can help you to develop your skills and advance your career.</p>
<p>In summary, contributing to open source projects can be a rewarding and valuable experience that offers a range of benefits, including the opportunity to learn, grow, and make a positive impact on the world.</p>
<h2 id="heading-my-story-of-open-source-contribution">My story of open source contribution</h2>
<p>The first time I contributed to open source is during hacktoberfest 2022. If you don't know about hacktoberfest then it is a global event where developers across the world, no matter if they are experienced or just starting out contribute to open-source projects via code or no code. And every year, it is conducted by the digital ocean.</p>
<p>I started out with some open-source projects. I remember I opened my first-ever pull request in a repository that wasn't super popular. It was a weather app. And the thing I did over there was, I changed the default city of the app and made it display the weather about that city.</p>
<p>And there was another project, I think it was something called 'TextUtils'. It was a web application made in react that featured all of the operations we can perform with text inside of a browser. For example:</p>
<p>I actually added a paste from the clipboard button there. Yes, it worked. And when I opened it up on firefox, the app crashed and I opened up the console, I found an error.</p>
<p>And that right there I opened up the first issue. I opened up the pull request with the paste button implemented and went to sleep. The next day I found out the maintainer of the repository wanted to solve the bug and she asked if I can solve the bug. I agreed and I was assigned the bug. I tried hard to fix it only to realize that SpeechRecognition isn't supported in Firefox. Then I just remove the feature on firefox. And yes the bug was fixed.</p>
<p>After that, I continued contributing to some more projects and started opening up issues in the open-source projects that I actually use like material UI.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>To conclude my whole experience, I can say that collaborating on some projects that have different coding standards and that have a huge impact on developer society is a big opportunity. Also, the real perk that comes when engaging with an open-source community is awesome.</p>
<p>And at last, I want to show my contribution graph for 2022 where you see a huge spike after October.</p>
<ul>
<li><p>Copying text on the clipboard</p>
</li>
<li><p>Pasting text from the clipboard</p>
</li>
<li><p>Changing the case of the string</p>
</li>
<li><p>Using speech recognition to take input</p>
</li>
<li><p>Text to speech</p>
</li>
</ul>
<p><img src="https://project-assets.showwcase.com/20656/1670682466708-Capture.PNG" alt /></p>
]]></content:encoded></item><item><title><![CDATA[Looking back to year 2022 - DevRetro]]></title><description><![CDATA[Hola, everyone. This is Aashish Panthi here.
First of all, COVID disappeared completely which was the happiest moment of my whole year 2022.
Let's get the context
Just like I learned some words in Spanish, I learned quite a few words in the programmi...]]></description><link>https://blog.aashish-panthi.com.np/looking-back-to-year-2022-devretro</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/looking-back-to-year-2022-devretro</guid><category><![CDATA[#DevRetro2022]]></category><category><![CDATA[2022]]></category><category><![CDATA[#DevRetro2022 #hashnode]]></category><category><![CDATA[Learning Journey]]></category><category><![CDATA[throwback]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Fri, 30 Dec 2022 23:56:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1671897667184/97f94e03-58dd-4ef3-bc19-2ec0b568e0b1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hola, everyone. This is <a target="_blank" href="https://github.com/aashishpanthi">Aashish Panthi</a> here.</p>
<p>First of all, <strong>COVID disappeared</strong> completely which was the happiest moment of my whole year 2022.</p>
<h3 id="heading-lets-get-the-context">Let's get the context</h3>
<p>Just like I learned some words in Spanish, I learned quite a few words in the programming world. This is my third year in development if I have to start from the beginning but <strong>my first year as a serious developer</strong>. And I want to give you the context of what I will discuss.</p>
<ul>
<li><p><a class="post-section-overview" href="#heading-my-open-source-contribution">My open-source contribution</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-my-learnings-2022">My learnings in 2022</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-my-first-hackathons">My participation in Hackathons this year</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-my-projects-this-year">My projects this year</a></p>
</li>
</ul>
<p>Little spoiler ahead, I am new to the programming world and got a lot of exposure this year. So from right on, a nerd developer will be the one taking with you, sound good?😅.</p>
<blockquote>
<p>I have a lot to share today and I am in a good mood for writing, so only one blog to reflect on my whole year's journey will not be enough (in my opinion). So, I might break it down into 3 - 4 blog articles.</p>
</blockquote>
<h2 id="heading-1-my-open-source-contribution">1. My open-source contribution</h2>
<p>To start, 2022 was the <strong>most productive year</strong> as a developer for me. I mean just look at my contribution graph.</p>
<p><img src="https://github.com/aashishpanthi/aashishpanthi/raw/output/github-contribution-grid-snake.svg" alt="contribution graph of aashish panthi" /></p>
<p>Yes, I have made more than <strong>1,000 contributions</strong> this year. I learned how to open up issues, how to <strong>open a pull request</strong>, and also to <strong>merge the pull request</strong>. Overall, I learned how to contribute to open source. I have shared more of it here.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/my-first-hacktoberfest-devretro">https://blog.aashish-panthi.com.np/my-first-hacktoberfest-devretro</a></div>
<p> </p>
<h2 id="heading-2-my-learnings-in-2022">2. My learnings in 2022</h2>
<p>No, I didn't learn any blockchain technology this year but made a project using <a target="_blank" href="https://thirdweb.com/">thirdweb</a> this year. Not very much that's just a fanboy trying out hot in tech.</p>
<p>From markup languages to high-level programming languages, from <strong>localhost to cloud</strong>, from free services to surprise billing, from using open source projects to contributing to them, and from <strong>watching videos to creating them</strong> for the community, I have come a long way and when I look back, I don't feel like it was just another year with only 365 days. I feel like the year was long.</p>
<p>I have added quite a few good technologies to my skills list on my CV and also put a few more on my bucket list for 2023. But I want to reflect more on my learnings this year. So, I decided to go for a separate article.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/what-i-learned-as-a-developer-in-2022-dev-retro">https://blog.aashish-panthi.com.np/what-i-learned-as-a-developer-in-2022-dev-retro</a></div>
<p> </p>
<h2 id="heading-3-my-first-hackathons">3. My first Hackathons</h2>
<p>As I mentioned, this is my first year as a serious developer which definitely means I did a lot of good things that developers do. And one of them is to challenge themselves to learn new technologies and develop a solution for a problem in a very less amount of time.</p>
<p>Yes, according to me, Hackathons are no more than (mostly) the use of new technology to solve a particular program in the minimum time possible.</p>
<p>I have won quite good prizes from taking part in hackathons this year. And learned heck lot of things just because I took part in hackathons. I took part in more than 15 online hackathons and I am on the way to the offline hackathon in 2023.</p>
<p><strong>Among those 15 hackathons</strong>, 5 of them were organized by Hashnode with some sponsors. And I became a winner on one of them while I became runner up in the next one.</p>
<p>Earlier this year, I wrote an article sharing my online hackathon experience but this one might cover all of the experiences I want to share.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.aashish-panthi.com.np/hackathons-dev-retro-2022">https://blog.aashish-panthi.com.np/hackathons-dev-retro-2022</a></div>
<p> </p>
<h2 id="heading-4-my-projects-this-year">4. My projects this year</h2>
<p>This is by far the most interesting section of my article and I am also most interested to share about it. Throughout this year, I build many projects. I built 2 mobile applications this year.</p>
<p>As you already might have guessed, I didn't know a bit about mobile application development prior but this year I took the fear out of me and developed two mobile applications.</p>
<p>You can just look at my projects by going to <a target="_blank" href="https://github.com/aashishpanthi?tab=repositories">my GitHub profile</a>. But let me share all of my projects here with short descriptions.</p>
<blockquote>
<p>The projects are organized according to the date of creation.</p>
</blockquote>
<div class="hn-table">
<table>
<thead>
<tr>
<td>S.N.</td><td>Name</td><td>Type</td><td>Description</td><td>Source code</td><td>Demo link</td></tr>
</thead>
<tbody>
<tr>
<td>1.</td><td>Hostque</td><td>website</td><td>A web template for cloud hosting provider.</td><td>https://github.com/aashishpanthi/hostque</td><td>https://hostque.netlify.app/</td></tr>
<tr>
<td>2.</td><td>NFTque</td><td>website</td><td>A NFT marketplace</td><td>https://github.com/aashishpanthi/NFTque</td><td>https://nftque.netlify.app/</td></tr>
<tr>
<td>3.</td><td>Samjhana</td><td>website</td><td>A place to write your last wish and fulfill others</td><td>https://github.com/aashishpanthi/samjhana</td><td>https://samjhana.netlify.app/</td></tr>
<tr>
<td>4.</td><td>Codyper</td><td>website</td><td>Learn programming while typing or vice-versa</td><td>https://github.com/aashishpanthi/codyper</td><td>https://codyper.netlify.app/</td></tr>
<tr>
<td>5.</td><td>Attende</td><td>Mobile application</td><td>A mobile application for attendance taking</td><td>https://github.com/aashishpanthi/attende</td><td>https://expo.dev/@aashishpanthi/attende</td></tr>
<tr>
<td>6.</td><td>Lootle</td><td>website</td><td>Track price of your product or stock</td><td>https://github.com/aashishpanthi/lootle.live</td><td>https://lootle.live</td></tr>
<tr>
<td>7.</td><td>Juhu</td><td>website</td><td>Search Engine</td><td>https://github.com/aashishpanthi/search-engine</td><td>https://juhu.live</td></tr>
<tr>
<td>8.</td><td>GitHub Lines of Code</td><td>website</td><td>Generate a dev card with the number of lines of code you have written</td><td>https://github.com/aashishpanthi/github-lines-of-code</td><td>https://dev.d35hk11gzwtpyz.amplifyapp.com/</td></tr>
<tr>
<td>9.</td><td>Hamro Earth</td><td>website</td><td>Track International Space station in 3D</td><td>https://github.com/saroj-regmi/Nasa-space</td><td>https://hamro.earth/</td></tr>
<tr>
<td>10.</td><td>Mailsbe</td><td>website</td><td>Know if your email was read or not</td><td>https://github.com/aashishpanthi/mailsbe</td><td>https://mailsbe.netlify.app/</td></tr>
<tr>
<td>11.</td><td>FIFA World Cup update</td><td>mobile application</td><td>A mobile app that gives you updates of world cup 2022 match</td><td>https://github.com/aashishpanthi/FIFA-World-Cup</td><td>https://expo.dev/@aashishpanthi/FIFA-World-Cup-2022</td></tr>
<tr>
<td>12.</td><td>Double vote prevention system</td><td>hardware project</td><td>Voting fraud prevention using Arduino</td><td></td></tr>
</tbody>
</table>
</div><p>Among these,</p>
<ul>
<li><p>I faced the most issues in mobile application development.</p>
</li>
<li><p>I got stuck for a longer time during the Hardware project.</p>
</li>
<li><p>The most amount of mental pressure I put on was over Search Engine.</p>
</li>
<li><p>The projects that are very useful and working perfectly fine are lootle and mailsbe.</p>
</li>
</ul>
<h2 id="heading-5-the-things-i-am-proud-of">5. The things I am proud of</h2>
<ul>
<li><p>The projects -&gt; I am proud of most projects I built in 2022</p>
</li>
<li><p>Blogs -&gt; I have written some great blogs in 2022</p>
</li>
<li><p>Videos -&gt; Learned to edit more cool videos</p>
</li>
<li><p>Client communications -&gt; English is my second language so trying to use it for work also.</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The thing which I am the proudest about in 2022 is doing good projects and learning from them. Also, joining developer communities, asking questions, and answering some questions there was very effective for me to grow as a developer.</p>
<p>I even wrote 35+ blogs this year and completed 10000+ page views on Hashnode.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1582371205507878915">https://twitter.com/aashishpanthi11/status/1582371205507878915</a></div>
<p> </p>
<p>In the end, I just want to say that, I am hyperactive on <a target="_blank" href="https://twitter.com/aashishpanthi11">Twitter</a>. We can chit-chat if you want to collaborate with me or simply have a conversation with me.</p>
]]></content:encoded></item><item><title><![CDATA[What I learned as a developer in 2022 - Dev Retro]]></title><description><![CDATA[To start, I started making websites in mid-2019. So, I can say that I have started my journey nearly 3 years ago. But I am proudest of the year 2022 as I have done heck lots of things this year.
On this new year's eve, I want to reflect on what I hav...]]></description><link>https://blog.aashish-panthi.com.np/what-i-learned-as-a-developer-in-2022-dev-retro</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/what-i-learned-as-a-developer-in-2022-dev-retro</guid><category><![CDATA[#DevRetro2022]]></category><category><![CDATA[learning]]></category><category><![CDATA[Learning Journey]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Fri, 30 Dec 2022 18:30:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1671898294610/b69754e3-ae39-47c3-9a95-0f30dd6dee4d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>To start, I started making websites in mid-2019. So, I can say that I have started my journey nearly 3 years ago. But I am proudest of the year 2022 as I have done heck lots of things this year.</p>
<p>On this new year's eve, I want to reflect on what I have learned in 2022. And also what I have planned to learn in 2023 as a developer.</p>
<p>So, I am still in High School. It's a senior year, I am not that young 😅. And I have a pressure of an examination that I have to take while wrapping up High school. Therefore, the words you are going to be reading can be written by a frustrated high scholar.</p>
<h2 id="heading-things-i-wanted-to-learn-in-2022">Things I wanted to learn in 2022</h2>
<p>I know many people have a new year's resolution. I am also planning to have one this year. But when starting out in 2022, I didn't have one so I struggle to find a path and learn the exact things I wanted to learn in 2022.</p>
<p>During and after COVID-19, there was a boom in blockchain and cryptocurrency. I was even curious to learn about it. I wanted to get my hands dirty with web3.</p>
<p>And that's all I had for a new year's resolution.</p>
<h2 id="heading-things-i-learned-in-2022">Things I learned in 2022</h2>
<p>I didn't have anything on my bucket list but I think at the end of this year I have half filled my bucket with new technologies and languages. So, let's get to them one by one.</p>
<h3 id="heading-1-react">1. React</h3>
<p>First and foremost, I can't forget about react. It's not like I didn't know anything about react in 2021. I have built some projects using it but they were simple. But by the start of 2022, I tried building some notorious things using this beast.</p>
<p>I have learned about Context API, UseEffect hooks, and other hooks. New ways of files and folder structuring. Serving the static, making a PWA with react, and also configuring the app before build to make sure it will work after build.</p>
<blockquote>
<p>Still I struggle to reload the UI after some updation in page. Please help me through that.</p>
</blockquote>
<h3 id="heading-2-express">2. Express</h3>
<p>Ok, this is another beast on the backend side. I think I didn't have a complete idea about this one. I started out with this guy in 2022 and I am still going with this guy and don't have any plans to leave this guy in near future.</p>
<p>Express with Joi validation and mongoose makes a complete backed application in half time.</p>
<h3 id="heading-3-mongodb">3. MongoDB</h3>
<p>I love this database, I abandoned MySQL when I started out with this and now I am in a situation where if anyone asks me to do a project using MySQL, I will have to spend a whole day relearning its syntax of it.</p>
<p>Still, I have installed MongoDB on my machine but I am using MongoDB atlas which works fine on database requests but is a painful experience to browse collections through the dashboard.</p>
<h3 id="heading-4-redis">4. Redis</h3>
<p>I think I wouldn't have learned Redis. I had to learn it because I wanted to give a try to one of the hackathons organized by Redis and Dev.to on dev.to platform. I had to build something using Redis so I did build a project.</p>
<p>The project I built using Redis was a Search Engine. Yes, I also learned how the search engine works in 2022 and also build a search engine this year that give me a satisfactory result for my search query.</p>
<p>Eventually, I woke up one day to be a runner-up in the hackathon. So, it was worth it to learn Redis. Although, I didn't find the documentation I was searching for.</p>
<h3 id="heading-5-dns-mapping">5. DNS mapping</h3>
<p>I was curious to learn how the domain works. How do we hide our IP address with some random texts that we had to buy for an unreasonable about? And yes, I am talking about the domain names being extremely expensive.</p>
<p>I got a domain from namecheap and also from name.com and played with them a lot. And I used Cloudflare for DNS mapping. It was free, fast, secure, and easy to use. A thumbs up for cloudflare.com.</p>
<h3 id="heading-6-linode">6. Linode</h3>
<p>How can I forget about the linode. I have learned to map domains from linode server. I have learned to access the linode server from a remote place using SSH and a password. And felt the pain to install of the dependencies from scratch instead of going for popular alternatives like netlify.com or heroku.com that come feature packed with everything.</p>
<h3 id="heading-7-sending-emails">7. Sending emails</h3>
<p>While learning to send emails through a web app, I got to learn about the mailing ports. I found out that 25 is the default mailing port and Linode by default blocks the mailing ports. I struggle to debug my application and after days of debugging, I finally found that solution. Or indeed a problem that was causing that problem.</p>
<h3 id="heading-8-digital-ocean">8. Digital Ocean</h3>
<p>Of course, the digital ocean provides credit to students but linode doesn't so I had to migrate to digital ocean after completing two months of free trial on linode.</p>
<p>And I got quite familiar with the digital ocean as it is similar to Linode. The only main difference is that digital is better in UI and documentation than Linode.</p>
<h3 id="heading-9-web3">9. Web3</h3>
<p>No, I am not so familiar with web3 but it is one of the things I touched on in 2022. I built a project using thirdweb.com.</p>
<p>I actually built an NFT marketplace called <a target="_blank" href="https://nftque.netlify.app/">NFTque</a> where you can mint, buy and sell your nfts.</p>
<h3 id="heading-10-web-scraping">10. Web Scraping</h3>
<p>What is better than a puppeteer when web scraping? I used puppeteer to scrape data from websites in two of my projects and actually deployed them on digitalocean on a raw Linux server💪.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Well, there are many things I learned in 2022. But as a developer, I think these are the things I learned. But as a non-developer, I learned to write blogs and learned to edit some cool videos. That is how I crossed 1k subscribers in my channel this year.</p>
<p>I didn't have a clear plan about what I wanted to do this year. But I will surely write down what I want to achieve in 2023 in my note and follow that. Right now, here are my rough estimates:</p>
<ul>
<li><p>I want to go for ML</p>
</li>
<li><p>I want to make an active open-source project with an active community</p>
</li>
<li><p>I will be taking my 1k subscriber channel to 50k</p>
</li>
<li><p>I will be learning python in 2023</p>
</li>
<li><p>I will be taking a gap</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[My first hacktoberfest - DevRetro]]></title><description><![CDATA[This is the first time I have heard about hacktoberfest and I have also joined hacktoberfest.
Just look at my contributions spike in  October month.

The first time I contributed to open source is during hacktoberfest 2022. If you don't know about ha...]]></description><link>https://blog.aashish-panthi.com.np/my-first-hacktoberfest-devretro</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/my-first-hacktoberfest-devretro</guid><category><![CDATA[#hacktoberfest ]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[#DevRetro2022]]></category><category><![CDATA[WeMakeDevs]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Fri, 30 Dec 2022 16:37:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1666508114665/490ft8BZm.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is the first time I have heard about hacktoberfest and I have also joined hacktoberfest.</p>
<p>Just look at my <mark>contributions spike in </mark> <a target="_blank" href="https://github.com/aashishpanthi"><mark>October month</mark></a><mark>.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1672417434762/b20962cb-1a4d-4232-8870-dadff78305a1.png" alt class="image--center mx-auto" /></p>
<p>The first time I contributed to open source is during hacktoberfest 2022. If you don't know about <strong>hacktoberfest then it is a global event where developers across the world</strong>, no matter if they are experienced or just starting out contribute to open-source projects via code or no code. And every year, it is conducted by the digital ocean.</p>
<p>I started out with some open-source projects. I remember I opened my first-ever pull request in a repository that wasn't super popular. It was a weather app. And the thing I did over there was, I changed the default city of the app and made it display the weather about that city.</p>
<p>And there was another project, I think it was something called 'TextUtils'. It was a web application made in react that featured all of the operations we can perform with text inside of a browser. For example:</p>
<ul>
<li><p>Copying text on the clipboard</p>
</li>
<li><p>Pasting text from the clipboard</p>
</li>
<li><p>Changing the case of the string</p>
</li>
<li><p>Using speech recognition to take input</p>
</li>
<li><p>Text to speech</p>
</li>
</ul>
<p>I actually added a paste from the clipboard button there. Yes, it worked. And when I opened it up on firefox, the app crashed and I opened up the console, I found an error.</p>
<p>And that right there I opened up the first issue. I opened up the pull request with the paste button implemented and went to sleep. The next day I found out the maintainer of the repository wanted to solve the bug and she asked if I can solve the bug. I agreed and I was assigned the bug. I tried hard to fix it only to realize that SpeechRecognition isn't supported in Firefox. Then I just remove the feature on firefox. And yes the bug was fixed.</p>
<p>That right there, I completed my first, second, third, and fourth pull requests. And I got this badge:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1672417279795/32256214-4575-40b5-8ed5-2ee4a246ba53.png" alt class="image--center mx-auto" /></p>
<p>And after a week of verification. I got holopin badges. Yes, I want to show you them here:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1672417775687/eab24773-0b6b-4401-819b-14b7a745f767.png" alt class="image--center mx-auto" /></p>
<p>Ans in tweet 😅</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1587476840771653633">https://twitter.com/aashishpanthi11/status/1587476840771653633</a></div>
<p> </p>
<p>After that, I continued contributing to some more projects and started opening up issues in the open-source projects that I actually use like material UI.</p>
<h2 id="heading-achievement">Achievement</h2>
<p>I didn't get a T-shirt. The thing is I wanted to have a T-shirt this year and I wanted to plant some trees the next year, <mark>yes I will take part again.</mark> But the T-shirts were finished as my final pull request was verified on 1st November.</p>
<p>Anyways, it feels great thinking I lifted up 120kg CO2 from the atmosphere.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1605914783253159941">https://twitter.com/aashishpanthi11/status/1605914783253159941</a></div>
<p> </p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This was my first hacktoberfest but this will not be my last. I learned more about the open-source community and how spam projects exist. I know I didn't contribute to some real-world projects this year but will be doing surely next year.</p>
<p>Thank you for your time :).</p>
]]></content:encoded></item><item><title><![CDATA[Hackathons - Dev Retro 2022]]></title><description><![CDATA[My first hackathon was this year, and I have completed nearly 15 online hackathons this year. Let me share my journey, achievements, and my failures.
Introduction
According to me, Hackathons are no more than (mostly) the use of new technology to solv...]]></description><link>https://blog.aashish-panthi.com.np/hackathons-dev-retro-2022</link><guid isPermaLink="true">https://blog.aashish-panthi.com.np/hackathons-dev-retro-2022</guid><category><![CDATA[#DevRetro2022]]></category><category><![CDATA[hackathon]]></category><category><![CDATA[Learning Journey]]></category><dc:creator><![CDATA[Aashish Panthi]]></dc:creator><pubDate>Fri, 30 Dec 2022 15:53:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1671898502558/d4f09c21-eb77-4020-be34-dbcf52129bc9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>My first hackathon was this year, and I have completed nearly <strong>15 online hackathons</strong> this year. Let me share my journey, achievements, and my failures.</p>
<h2 id="heading-introduction">Introduction</h2>
<p>According to me, Hackathons are no more than <em>(mostly)</em> the use of new technology to solve a particular program in the minimum time possible. Also, most of them have swags and prizes.</p>
<p><img src="https://media0.giphy.com/media/h0MTqLyvgG0Ss/giphy.gif" alt="Money" class="image--center mx-auto" /></p>
<p>Nah Nah Nah, It isn't that much money, but you get in a fair amount. Let me now share my participation and achievements.</p>
<h2 id="heading-my-participation">My participation</h2>
<p>I have won quite good prizes from taking part in hackathons this year. And <mark>I learned a heck lot of things</mark> just because I took part in hackathons.</p>
<p>Let me just create a timeline of hackathons:</p>
<h3 id="heading-1-thirdweb-x-hashnodehttpstownhallhashnodecomthirdweb-hackathon">1. <a target="_blank" href="https://townhall.hashnode.com/thirdweb-hackathon">Thirdweb x Hashnode</a></h3>
<p>It was organized by our very own <a class="user-mention" href="https://hashnode.com/@thirdweb">thirdweb</a> and <a target="_blank" href="https://hashnode.com">hashnode</a>. I didn't have any idea but it was on January 2022. Meaning I started hackathons at the beginning of 2022. Yes, it feels strange now knowing when I started.</p>
<blockquote>
<p>It was my first hackathon so I just wrote a lot of thing, now let me just wirte in short.</p>
</blockquote>
<ul>
<li><p><strong>Date:</strong> January 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Nah</p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="http://thirdweb.com">Thirdweb</a></p>
</li>
<li><p><strong>Project</strong>: A NFT marketplace <em>(Buy, sell and mint NFT)</em></p>
<ul>
<li><p><a target="_blank" href="https://nftque.netlify.app/">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/NFTque">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings">Learnings:</h4>
<p>It was my first web3 project. I learned about metamask wallet, and how to use the Ethereum network. And most important of all, I learned data once written can't be erased from the blockchain. This is the only reason why I haven't continued in web3 afterward.</p>
<h3 id="heading-2-netlify-x-hashnodehttpstownhallhashnodecomnetlify-hackathon">2. <a target="_blank" href="https://townhall.hashnode.com/netlify-hackathon">Netlify x Hashnode</a></h3>
<ul>
<li><p><strong>Date:</strong> February 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Nah</p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://netlify.com">Netlify</a></p>
</li>
<li><p><strong>Project</strong>: A place to write your last wish and fulfill others</p>
<ul>
<li><p><a target="_blank" href="https://samjhana.netlify.app/">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/samjhana">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-1">Learnings</h4>
<p>I learned to use netlify better. I used netlify form submissions with React. I used firebase, I used to be scared of it at that time. Also, learned to edit videos (for demo).</p>
<h3 id="heading-3-hasura-x-hashnodehttpstownhallhashnodecomhasura-hackathon">3. <a target="_blank" href="https://townhall.hashnode.com/hasura-hackathon">Hasura x Hashnode</a></h3>
<ul>
<li><p><strong>Date:</strong> March 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Yes, <a target="_blank" href="https://townhall.hashnode.com/hasura-x-hashnode-hackathon-winners">Runner up</a></p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://hasura.io">Hasura</a></p>
</li>
<li><p><strong>Project</strong>: Learn programming while typing or vice-versa</p>
<ul>
<li><p><a target="_blank" href="https://codyper.netlify.app/">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/codyper">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-2">Learnings</h4>
<p>The very new thing I learned during this hackathon is that <mark>fonts have different widths </mark> . Also, monospace letters have equal width.</p>
<h3 id="heading-4-linode-x-hashnodehttpstownhallhashnodecombuild-with-linode-hackathon-june-2022">4. <a target="_blank" href="https://townhall.hashnode.com/build-with-linode-hackathon-june-2022">Linode x Hashnode</a></h3>
<ul>
<li><p><strong>Date:</strong> June 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Yes, <a target="_blank" href="https://townhall.hashnode.com/linode-x-hashnode-hackathon-winners">Winner</a></p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://www.linode.com/">Linode</a></p>
</li>
<li><p><strong>Project</strong>: Track price of your product or stock</p>
<ul>
<li><p><a target="_blank" href="https://lootle.live">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/lootle.live">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-3">Learnings</h4>
<p>In this hackathon, I learned <mark>web scraping using puppeteer</mark>. Also, to host a MERN web app on a raw <strong>linux server</strong> and map to a domain using <strong>Nginx.</strong></p>
<blockquote>
<p>Two hackathons in a row. Oh boy, that was epic.</p>
</blockquote>
<h3 id="heading-5-redis-x-devtohttpsdevtodevteamannouncing-the-redis-hackathon-on-dev-3248">5. <a target="_blank" href="https://dev.to/devteam/announcing-the-redis-hackathon-on-dev-3248">Redis x Dev.to</a></h3>
<ul>
<li><p><strong>Date:</strong> August 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Yes, <a target="_blank" href="https://dev.to/devteam/redis-hackathon-winners-announced-524d">Runner up</a></p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="http://redis.com">Redis</a></p>
</li>
<li><p><strong>Project</strong>: Search Engine</p>
<ul>
<li><p><a target="_blank" href="https://juhu.live">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/search-engine">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-4">Learnings</h4>
<p>In this hackathon, I enhanced my learning of <mark>web scraping using puppeteer</mark>. Also, to host a MERN web app on a raw <strong>digital ocean droplet</strong> and map it to a domain using <strong>Nginx.</strong> And using <strong>Redis</strong> as a database on its top.</p>
<blockquote>
<p>Wow, three in a row 😅</p>
</blockquote>
<h3 id="heading-6-aws-amplify-x-hashnodehttpstownhallhashnodecomaws-amplify-hackathon">6. <a target="_blank" href="https://townhall.hashnode.com/aws-amplify-hackathon">Aws Amplify x Hashnode</a></h3>
<ul>
<li><p><strong>Date:</strong> September 2022</p>
</li>
<li><p><strong>Duration</strong>: 1 month</p>
</li>
<li><p><strong>Won</strong>? -&gt; Nah</p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://aws.amazon.com/amplify/">AWS Amplify</a></p>
</li>
<li><p><strong>Project</strong>: Generate a dev card with the number of lines of code you have written</p>
<ul>
<li><p><a target="_blank" href="https://juhu.live">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/github-lines-of-code">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-7-nasa-spaceapps-hackathonhttpstownhallhashnodecomaws-amplify-hackathon">7. <a target="_blank" href="https://townhall.hashnode.com/aws-amplify-hackathon">NASA Spaceapps hackathon</a></h3>
<ul>
<li><p><strong>Date:</strong> October 2022</p>
</li>
<li><p><strong>Duration</strong>: 36 hours</p>
</li>
<li><p><strong>Won</strong>? -&gt; Nah</p>
</li>
<li><p><strong>Tech to use:</strong> NASA APIs</p>
</li>
<li><p><strong>Project</strong>: International Space Station tracker</p>
<ul>
<li><p><a target="_blank" href="https://hamro.earth">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/saroj-regmi/Nasa-space">Source code</a></p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>After this, Hacktoberfest started and I started taking part in a lot of hackathons. Let me share only few of them in details.</p>
</blockquote>
<h3 id="heading-8-nhost-x-reacplayhttpshustlesreactplayiohackrplay2022home">8. <a target="_blank" href="https://hustles.reactplay.io/hackrplay/2022/home">Nhost x ReacPlay</a></h3>
<ul>
<li><p><strong>Date:</strong> October 2022</p>
</li>
<li><p><strong>Duration</strong>: 14 days</p>
</li>
<li><p><strong>Won</strong>? -&gt; Yes, <a target="_blank" href="https://hustles.reactplay.io/hackrplay/2022/home">Third</a></p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://nhost.io/">Nhost</a></p>
</li>
<li><p><strong>Project</strong>: Know if your email was read or not</p>
<ul>
<li><p><a target="_blank" href="https://mailsbe.netlify.app/">Live website</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/mailsbe">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-5">Learnings</h4>
<p>In this hackathon, I learned <mark>pixel tracking</mark>. Also, to use <a target="_blank" href="https://nhost.io/">Nhost</a> as a database, doing <strong>Graphql requests,</strong> and use <strong>Nhost serverless functions</strong>.</p>
<h3 id="heading-9-notjustdev-x-nhost-x-streamhttpswwwnotjustdevhack">9. <a target="_blank" href="https://www.notjust.dev/hack">Notjust.dev x Nhost x Stream</a></h3>
<ul>
<li><p><strong>Date:</strong> November 2022</p>
</li>
<li><p><strong>Duration</strong>: 48 hours</p>
</li>
<li><p><strong>Won</strong>? -&gt; Yes, <a target="_blank" href="https://www.notjust.dev/hack#h-1-special-prize-from-notjust-academy">Special price winner</a></p>
</li>
<li><p><strong>Tech to use:</strong> <a target="_blank" href="https://nhost.io/">Nhost</a> or <a target="_blank" href="https://www.notjust.dev/hack#h-1-special-prize-from-notjust-academy">Stream</a></p>
</li>
<li><p><strong>Project</strong>: A mobile app that gives you updates on the world cup 2022 match</p>
<ul>
<li><p><a target="_blank" href="https://expo.dev/@aashishpanthi/FIFA-World-Cup-2022">App download</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/aashishpanthi/FIFA-World-Cup">Source code</a></p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-learnings-6">Learnings</h4>
<p>In this hackathon, I learned <mark>to build a mobile application with React Native</mark>. Also, to use <strong>Stream for chat messaging</strong>.</p>
<h3 id="heading-10-steel-city-code">10. Steel city code</h3>
<h3 id="heading-11-findcoderio-x-locofyai">11. Findcoder.io x locofy.ai</h3>
<h3 id="heading-12-medusamedusajs-js-hackathon">12. <a class="user-mention" href="https://hashnode.com/@medusajs">Medusa</a> js hackathon</h3>
<h3 id="heading-13-inov-8-hackathon">13. Inov-8-hackathon</h3>
<h3 id="heading-14-mongodb-x-devto">14. MongoDB x Dev.to</h3>
<blockquote>
<p>I don't even remember other hackathons😅.</p>
</blockquote>
<p>Yes, I don't have any experience with offline hackathons, I know some of the rules and time periods but for the most, I have only participated in a 5-hour-long offline competition (which I will not call a hackathon). At least I have participated in some online hackathons, so here is my experience with online hackathons.</p>
<h2 id="heading-achievements">Achievements</h2>
<p>I feel great looking at my hackathon journeys, I built a lot of good projects this year. And want to build a lot more. Before that let me share some of my achievements here:</p>
<h4 id="heading-got-featured-in-linodes-craft-of-code">Got featured in Linode's craft of code</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/linode/status/1595401824621981697">https://twitter.com/linode/status/1595401824621981697</a></div>
<p> </p>
<h4 id="heading-got-a-participation-certificate-from-steel-city-codes">Got a participation certificate from steel city codes</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1606877728061681665">https://twitter.com/aashishpanthi11/status/1606877728061681665</a></div>
<p> </p>
<h4 id="heading-120kg-co2-offset">120kg CO2 offset</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1605914783253159941">https://twitter.com/aashishpanthi11/status/1605914783253159941</a></div>
<p> </p>
<h4 id="heading-special-prize-from-notjustdev">Special prize from Notjust.dev</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/VadimNotJustDev/status/1597292800323846146">https://twitter.com/VadimNotJustDev/status/1597292800323846146</a></div>
<p> </p>
<h4 id="heading-got-a-participation-certificate-from-the-medusamedusajs-hackathon">Got a participation certificate from the <a class="user-mention" href="https://hashnode.com/@medusajs">Medusa</a> hackathon</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1592219535264083969">https://twitter.com/aashishpanthi11/status/1592219535264083969</a></div>
<p> </p>
<h4 id="heading-third-position">Third position</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/ReactPlayIO/status/1586942486920204288">https://twitter.com/ReactPlayIO/status/1586942486920204288</a></div>
<p> </p>
<h4 id="heading-findcoderio-hackathon-participation-certificate">Findcoder.io hackathon participation certificate</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1585976064299634688">https://twitter.com/aashishpanthi11/status/1585976064299634688</a></div>
<p> </p>
<h4 id="heading-nasa-spaceapps-participation-certificate">NASA Spaceapps participation certificate</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1577970981578366976">https://twitter.com/aashishpanthi11/status/1577970981578366976</a></div>
<p> </p>
<h4 id="heading-linode-hackathon-winner">Linode hackathon winner</h4>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/aashishpanthi11/status/1549770209736933377">https://twitter.com/aashishpanthi11/status/1549770209736933377</a></div>
<p> </p>
<h1 id="heading-summary">Summary</h1>
<p>To summarize the whole journey, I got various opportunities to learn more stuffs, explore new technologies, and engage with the community. Most importantly I was able to manage some time for these events. I don't know how but I passed two exams during these hackathons. I have also participated in other hackathons but I didn't find any room to fit that in here so I left it.</p>
]]></content:encoded></item></channel></rss>