<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Puskar Adhikari on Medium]]></title>
        <description><![CDATA[Stories by Puskar Adhikari on Medium]]></description>
        <link>https://medium.com/@puskar.ad?source=rss-71e9b8606171------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R-K_IFulZGxGyX-KJPu1aw.jpeg</url>
            <title>Stories by Puskar Adhikari on Medium</title>
            <link>https://medium.com/@puskar.ad?source=rss-71e9b8606171------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:43:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@puskar.ad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to hide your API keys in React.]]></title>
            <link>https://medium.com/@puskar.ad/how-to-hide-your-api-keys-in-react-f2b564406c26?source=rss-71e9b8606171------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b564406c26</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[secure]]></category>
            <dc:creator><![CDATA[Puskar Adhikari]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 14:14:51 GMT</pubDate>
            <atom:updated>2020-06-01T14:39:16.387Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAoM-44ZoORTBGAKvoEHXQ.png" /></figure><p>An API key or application programming interface key is a code that gets passed in by computer applications. The program or application then calls the API to identify its user, developer or calling program to a website.</p><p>Application programming keys are normally used to assist in tracking and controlling how the interface is being utilized. Often, it does this to prevent abuse or malicious use of the API in question.</p><p>An API key is both incredibly powerful and extremely vulnerable. API key exposure can result in significant damage, both to a company and to the data it holds. As such, hiding and securing keys (as well as a mitigating potential loss) is critical for any security plan in the modern API space</p><h4>So, how do we hide it in React? Here is how to do it in a React app:</h4><ol><li>Create a file called `.env` in the root of your project’s directory.</li></ol><pre>node_modules<br>public    <br>src    <br>.env     &lt;---- Here<br>.gitignore    <br>LICENSE    <br>README.md    <br>package-lock.json    <br>package.json</pre><p><strong>2. Inside the </strong><strong>.env file, prepend </strong><strong>REACT_APP_ to your API key name of choice and assign it.</strong></p><p>REACT_APP_ is, in fact, a tool that create-react-app uses to identify these variables.</p><pre>// .env<br>API_KEY=your_api_key            &lt;-- this won&#39;t work<br>REACT_APP_API_KEY=your_api_key  &lt;-- yes! this work<br>// Example:<br>// REACT_APP_GOOGLE_API_KEY=123456</pre><p><strong>3. Add the </strong><strong>.env file to your </strong><strong>.gitignore file.</strong></p><p>You don’t want this file to be committed to gitHub!</p><pre>// .gitignore</pre><pre># api keys<br>.env       &lt;-- add this line</pre><pre># dependencies<br>/node_modules<br>...</pre><p>After you’ve saved .gitignore, run $git status to make sure that .env is not on the list of changes to be committed.</p><p><strong>4. Access the API key via the </strong><strong>process.env object.</strong></p><p>To check that you can access your API key, go to your App.js file and add console.log at the top below the require statements. After saving the file and reloading the page, if the console log does not show your API key, try restarting the react server. And of course, make sure to remove the console.log line before committing your code.</p><pre>// src/App.js<br>import React, { Component } from &#39;react&#39;;<br>import &#39;./App.css&#39;;<br>console.log(process.env.REACT_APP_GOOGLE_API_KEY)<br>class App extends Component {<br>...</pre><blockquote>The accidental synchronization of secure code is not uncommon. The solutions to hide is very easy to implement and can be done broadly across almost any current implementation. Ensuring the security of your API key should be a major focus for any organization or personal project, and is a first major step for any security plan. What do you think about this implementation?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b564406c26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Promises and reason to use them.]]></title>
            <link>https://medium.com/@puskar.ad/javascript-promises-and-reason-to-use-them-d559b2c97c2d?source=rss-71e9b8606171------2</link>
            <guid isPermaLink="false">https://medium.com/p/d559b2c97c2d</guid>
            <dc:creator><![CDATA[Puskar Adhikari]]></dc:creator>
            <pubDate>Sun, 03 May 2020 09:38:51 GMT</pubDate>
            <atom:updated>2020-05-03T09:38:51.205Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*41Uryq6--_JLdZ3kUcWxYw.png" /></figure><p>Being a JavaScript developer we have to deal with <strong><em>Asynchronous code</em></strong>, especially, when your application has too much of I/O in it. o deal with asynchronous code,<strong><em> callbacks</em></strong> &amp;<strong><em> promises</em></strong> makes their way into the picture. Promises turn out to be more promising for making the code behave synchronously. In this article, we try to understand <strong><em>why to use JavaScript promises.</em></strong></p><h4><strong>What is Promises?</strong></h4><p>A promise is an object that may produce a single value sometime in the future: either a resolved value or a reason that it’s not resolved (e.g., a network error occurred). A promise may be in one of 3 possible states: fulfilled, rejected, or pending. Promise users can attach callbacks to handle the fulfilled value or the reason for rejection. Promises are eager, meaning that a promise will start doing whatever task you give it as soon as the promise constructor is invoked.</p><h4><strong>How JavaScript Promises Work</strong></h4><p>JavaScript Promises work in one of 3 below possible states.</p><ul><li><em>pending: </em>initial state, neither fulfilled nor rejected.</li><li><em>fulfilled:</em> meaning that the operation completed successfully.</li><li><em>rejected:</em> meaning that the operation failed.</li></ul><p><strong>1) Ease of Use</strong></p><p>JavaScript promises make our code look so clean and they are easy to learn, understand, and debug.</p><p><strong>2) Handling errors</strong></p><p>When anything in the chain of promises fails and raises an error or rejects the promise, the control goes to the nearest catch() statement down the chain.</p><pre>new Promise((resolve, reject) =&gt; {<br>  reject(&#39;Error&#39;)<br>}).catch(err =&gt; {<br>  console.error(err)<br>})</pre><p><strong>3) Cascade errors handling</strong></p><p>If inside the catch() you raise an error, you can append a second catch() to handle it, and so on.</p><pre>new Promise((resolve, reject) =&gt; {<br>  throw new Error(&#39;Error&#39;)<br>})<br>  .catch(err =&gt; {<br>    throw new Error(&#39;Error&#39;)<br>  })<br>  .catch(err =&gt; {<br>    console.error(err)<br>  })</pre><p><strong>4) Chaining promises</strong></p><p>A promise can be returned to another promise, creating a chain of promises.</p><p>A great example of chaining promises is given by the Fetch API, a layer on top of the XMLHttpRequest API, which we can use to get a resource and queue a chain of promises to execute when the resource is fetched.</p><pre>const status = response =&gt; {<br>  if (response.status &gt;= 200 &amp;&amp; response.status &lt; 300) {<br>    return Promise.resolve(response)<br>  }<br>  return Promise.reject(new Error(response.statusText))<br>}</pre><pre>const json = response =&gt; response.json()</pre><pre>fetch(&#39;/todos.json&#39;)<br>  .then(status)<br>  .then(json)<br>  .then(data =&gt; {<br>    console.log(&#39;Request succeeded with JSON response&#39;, data)<br>  })<br>  .catch(error =&gt; {<br>    console.log(&#39;Request failed&#39;, error)<br>  })</pre><blockquote>#HappyCoding🚀</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d559b2c97c2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why every developer should use Git]]></title>
            <link>https://medium.com/@puskar.ad/why-every-developer-should-use-git-203acf8bcc8a?source=rss-71e9b8606171------2</link>
            <guid isPermaLink="false">https://medium.com/p/203acf8bcc8a</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[version-control-system]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Puskar Adhikari]]></dc:creator>
            <pubDate>Thu, 11 Oct 2018 19:26:13 GMT</pubDate>
            <atom:updated>2018-11-26T08:54:11.334Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*-T_g1mztye71hqPy96xS9A.png" /></figure><p>Git is a version control system which is primarily used for source-code management in software development. It is designed to handle all kinds of small and big types of projects. Using git we can keep a track of changes in any set of files among multiple people and with its help we can work offline.</p><h3>Why I use git</h3><p>Being a learner and a front-end web developer a lot of time I tend to work on local development sites then just upload everything when I am done coding. This is fine when I work on a small project or for practice purpose. But when I have to deal with lots of complicated project with the different team member that is simply not feasible. That’s when I turn to something called <strong>git</strong> .</p><p>Git allows me to have “version” of a project which shows the changes that were made to the code over time, and allows me to backtrack if necessary and undo the changes. This ability alone of being able to compare two version of the code or reverse changes, make it fairly invaluable when working on a larger project.</p><p>Using git operation, I can control the version of any big and small project and handle it in a short period of time. Some of the basic operations of git are:</p><ol><li>Init</li><li>Add</li><li>Commit</li><li>Pull</li><li>Push</li><li>Branch</li><li>Merge</li><li>Rebase</li></ol><p>These are some basic operations used on daily basis, all of the operations requires to have an origin, also known as repo or repository. A <strong>Git Repository </strong>is a virtual storage of your project. It allows you to save a version of your code which can be accessible when needed.</p><h4><strong>Initialize</strong></h4><p>In<strong> </strong>order to initialize we use<strong><em> “git init” </em></strong>command. This command creates a new git repository or no-initializes an exiting one. It is used to convert an existing, non-versioned project to a git repository or initialize a new, empty repository. It basically creates a “<em>.git” </em>directory with subdirectories and template files.</p><h4>Add</h4><p>This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit. Thus, after making changes to the working tree, and before running the commit command we must use <strong><em>“git add &lt;filename&gt;”</em></strong> command to add any new or modified files to the index. With this command, we also need git status command to obtain the summery of the working directory and the staging area.</p><h4>Commit</h4><p>This command is used to store the current contents of the index in the new commit. In git, a commit adds the latest changes to the source code to the repository, making these changes part of the head revision of the repository. Some important options of git commit are:</p><ol><li><strong>-m </strong>:- <em>It sets the commit message.</em></li><li>-<strong>a</strong> :- <em>It includes all the currently changed files in the commit.</em></li><li><strong>--amend</strong> :-<em> It rewrites the very last commit with any currently staged changes and/or a new commit message.</em></li></ol><h4>Pull</h4><p>The <em>“pull”</em> command is used to fetch and download content from a remote repository and immediately update the local repository to match the content. The git pull command is actually a combination of two other commands, git fetch followed by git merge. In the first stage of operation, <em>git pull </em>will execute a <em>git fetch</em> scoped to the local branch that HEAD is printed at. Once the content is downloaded, <em>git pull</em> will enter a merge workflow. A new merge commit will be created and HEAD updated to point at the new commit.</p><h4>Push</h4><p>The “push” command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repository. It’s the counterpart to the git fetch, but whereas fetching imports commits to a local branch, pushing exports commits to the remote branches. Remote branches are configured using the git remote command. Pushing has the potential to overwrite changes, caution should be taken when pushing.</p><h4>Branching</h4><p>Branching means you diverge from the main line of development and continue to do work without messing with that mainline. In git, branching is a part of your everyday development process. Git branches are effectively a pointer to a snapshot of your changes. When you want to add a new feature or fix bug, matter how big or how small you spawn a new branch to encapsulate your changes.</p><p>The git branch command lets you create, list, rename and delete branches. It doesn’t let you switch between branches or put a forked history back together again.</p><h4>Merging</h4><p>Merging is git way of putting a forked history back together again. The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch. Git merge will combine multiple sequences of commit into one unified history. In the most frequent use cases, git merge is used to combine two branches.</p><h4>Rebasing</h4><p>Rebasing<strong> </strong>is the process of moving or combining a sequence of commit to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.</p><h3>Version Control Hosting Software</h3><p>Version control hosting solution are a product that host multiple code repository in the cloud and integrate with and often provide online tools that enhance the use of version control system. Version control hosting solutions allows developers who collaborate on the source code to manage a master repository in which they can commit their code changes and pull down the new code to their local computer. Some of the version control hosting software are:-</p><ol><li><a href="http://github.com/">GitHub</a></li><li><a href="https://about.gitlab.com/">GitLab</a></li><li><a href="http://bitbucket.com/">Bitbucket</a></li><li><a href="http://jfrog.com/">JFrog</a></li><li><a href="http://assembla.com/">Assembla</a></li><li><a href="https://beanstalkapp.com/">Beanstalk</a></li></ol><h3>Basic Process to add any folder on GitHub using git (for beginners)</h3><p>Firstly, download a git bash on your laptop or computer and install it. And sing into <a href="http://github.com/">GitHub</a> if you have an account otherwise create an account.</p><p>After logging in or creating an account, create a new repository in GitHub and copy the link of that repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0YVT5YQHxWQa8r1DwTuxQ.png" /></figure><p>Now, you’ll follow the following step to upload any folder on GitHub.</p><p>Right-click the folder and click <strong><em>“Git Bash Here”</em></strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBEqsF0NGd5kAoiFYerEzg.png" /></figure><p>2. Initialize using a command “<strong>git init”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*OpjhJmOJfZOgmAPlm9p6Rw.png" /></figure><p>3. Enter a command “<strong><em>git remote add origin &lt;link&gt;” </em></strong>and past the link we copied while creating a repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*7ftTW7Zmcz0WmXVE4TBUEQ.png" /></figure><p>4. Enter a command <strong><em>“git remote -v”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*FbQQHbIW2tFSqWcoUfC22Q.png" /></figure><p>5. Now add it using “<strong><em>git add .” </em></strong>command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*17Gd_3O5CSHm90ovADEHKA.png" /></figure><p>6. Commit to add the message using “<strong><em>git commit -m” </em></strong>command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*hT1h4wXaOx32LF5FCAVMoQ.png" /></figure><p>7. Finally, push it using “<strong><em>git push” </em></strong>command. Don’t forget to enter “origin master” after the command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*BDvL-Zx4LgOTJH1Qom8zXQ.png" /></figure><p>Now you can refresh your browser and see your repository where your folder is already added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2UFgqMB_vwy8sQLOH3n-LQ.png" /></figure><h4><em>#happy_Coding</em> 😊😎👍</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=203acf8bcc8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Front-End Web Development]]></title>
            <link>https://medium.com/@puskar.ad/front-end-web-development-d19f4191dc8a?source=rss-71e9b8606171------2</link>
            <guid isPermaLink="false">https://medium.com/p/d19f4191dc8a</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Puskar Adhikari]]></dc:creator>
            <pubDate>Thu, 04 Oct 2018 10:22:59 GMT</pubDate>
            <atom:updated>2018-10-08T10:35:30.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yRV0OFRyZqFlodNWuN2X7Q.jpeg" /></figure><p><strong>Front-end web development</strong> is the practice of converting data to graphical interface for user to view and interact with data through digital interaction. It makes the application user friendly and feel of sites. Front end web development mostly focused on then interaction and users experience. Front end web development deals with the style, animation and graphics.</p><p>Font end development is ignored sometime and also considered to be minor in some areas. People call front end developer by the name of htmler, designer,drag and drop etc, which may not be wrong but makes no sense to me. You know how a luxury product is sold right, you know the packing and the appearance of it.. To make an application responsive front-end developer uses 3 core technology — HTML, JavaScript (JS), and CSS. Front end developers are responsible to make front end free from errors and look exactly as designed.</p><h3><strong>Skills to know for front-end web development</strong></h3><p>To make a website responsive and make user friendly application or website front-end developer must have some skills to design and develop. Here is some list of skills every front developer must need.</p><p><strong>1) HTML</strong></p><p>Hyper Text Markup Language is the backbone of any website. Without HTML web page doesn’t exist. Without HTML we can’t create a web site design, and we will be ended up with unformatted plain text on the screen. We can’t even add image to a page without HTML. Using HTML, we can add paragraph, text, image, tables, links and many other representations.</p><p><strong>2) CSS</strong></p><p>Cascading Style Sheet (CSS) is the style sheet language that is used for describe the HTML. CSS is use by front end-developer to present the document we create with HTML. CSS is use to make the web page layout, color, font size, animation, styling and many more.</p><p><strong>3) JavaScript</strong></p><p>A JavaScript is a high level, interpreted dynamic and untyped programming language that allows us to implement complex things on web page. Alongside HTML and CSS JavaScript is one of the three core technology of front-end web development. HTML and CSS determine the presentation of page whereas JS determine the function of Website. If we need to add video, games, animation we use JS to implement them. JavaScript in HTML is used similar way to CSS, whereas CSS use &lt;link&gt; tag to apply externally and JavaScript use &lt;script&gt; tag to use externally as well as internally.</p><p><strong>4) jQuery</strong></p><p>jQuery is the free, open-source software. It is the library which is made of JavaScript which aim is to “Write less, Do more”. Front-end developer use jQuery because it is more popular and most extendable. Many biggest companies like Google, Microsoft, IBM, Netflix and many more uses jQuery. Some features of jQuery are:</p><p>· CSS Manipulation</p><p>· HTML/DOM manipulation</p><p>· HTML event method</p><p>· AJAX</p><p>· Effect and animation</p><p><strong>5) Frameworks</strong></p><p>A framework, or software framework, is a platform for developing software application. It provides a foundation on which software developers can build programs for a specific platform. For example, a framework may include predefined classes and function that can be used to process input, manage hardware devices, and interact with system software. Front-end developer uses many frameworks like AngularJS, Backbone, Ember, Bootstrap, and many other. The main purpose of framework is to provide a common structure so that developers don’t have to redo it from scratch and can reuse the code provided.</p><h3><strong>Jobs Front-End Programmer do</strong></h3><p>There are many options for front-end developer if they have gained many skills and experience in their field. You can get a job easily in any IT company if your are excellent in your field. According to PayScale, the starting salary of front-end developers is about $67k. Front end developer work in the following field:</p><p>· Front end developer</p><p>· Web designer</p><p>· UI/UX designer</p><h3>How to take a course</h3><p>If you want to be a front-end developer and don’t know how to learn those skills I suggest you to watch tutorials, read articles and buy Udemy course but don’t go any institution. Some of the website where we can learn front end development are:</p><p>· <a href="http://www.w3schools.com/">www.w3schools.com</a></p><p>· <a href="http://www.freecodecamp.org/">www.freecodecamp.org</a></p><p>· <a href="http://www.sololearn.com/">www.sololearn.com</a></p><p>· <a href="http://www.udemy.com/">www.udemy.com</a></p><p>· <a href="http://www.edx.org/">www.edx.org</a></p><p>· <a href="http://www.coursera.org/">www.coursera.org</a></p><p>· <a href="http://www.codewars.com/">www.codewars.com</a></p><p><a href="http://www.codeavengers.com/">www.codeavengers.com</a></p><h4>Best Wishes :)</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d19f4191dc8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>