<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thanh Tien Phat Nguyen</title>
    <description>The latest articles on DEV Community by Thanh Tien Phat Nguyen (@phast184).</description>
    <link>https://dev.to/phast184</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471580%2Ff2c7a9fa-9d0f-42c4-a7cf-8bd6fccacf3a.jpeg</url>
      <title>DEV Community: Thanh Tien Phat Nguyen</title>
      <link>https://dev.to/phast184</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phast184"/>
    <language>en</language>
    <item>
      <title>Publish your first package on npm!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Sun, 06 Dec 2020 04:51:04 +0000</pubDate>
      <link>https://dev.to/phast184/publish-your-first-package-on-npm-6p</link>
      <guid>https://dev.to/phast184/publish-your-first-package-on-npm-6p</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This week we are asked to release our work by choosing a release method. To make our work, I decided to release my very first package on NPM. You can also check it out at &lt;a href="https://www.npmjs.com/package/link-checker-tool"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why NPM?
&lt;/h3&gt;

&lt;p&gt;There are several reasons why I decided to choose NPM as my release method. Firstly, NPM is super popular to the developers all around the world. Therefore, publishing my package on the site would be a good idea. Moreover, since all of the dependencies used in my projects are published on NPM, it gives me a solid reason to go with NPM&lt;/p&gt;

&lt;h3&gt;
  
  
  How?
&lt;/h3&gt;

&lt;p&gt;To publish my first ever package on NPM, these are the steps that I took at the time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/signup"&gt;You need to create an account on npm first.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating your first account, navigate to the root folder of your project. At the terminal, use this command to login:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Next, create a &lt;code&gt;package.json&lt;/code&gt; file in your folder.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;You can change the name and the version of your package inside your &lt;code&gt;package.json&lt;/code&gt; file. Below is what I did in my file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "link-checker-tool",
  "version": "1.0.2",
  "description": "A tool used to check whether an URL is available or not",
  "bin": {
    "lct": "/link-checker.js"
  },
  "keywords": [
    "cli"
  ],
  "scripts": {
    ...
  },
  "preferGlobal": true,
  "author": "Thanh Tien Phat Nguyen",
  "license": "ISC",
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To make it easy for other people understand how to use your package, update your README.md document which allows users to have some basic knowledge about your package. Below is a piece of my README.md, you can check the full version at &lt;a href="https://www.npmjs.com/package/link-checker-tool"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gT6khYib--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4i63h1nvh6kpzb419i5z.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gT6khYib--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4i63h1nvh6kpzb419i5z.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lastly, publish your package by using this command:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;If you get the message below, your package is published successfully.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R01kZA05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h9134l7qh48bc7ifpo1u.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R01kZA05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h9134l7qh48bc7ifpo1u.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use my package?
&lt;/h3&gt;

&lt;p&gt;My package this is an CLI that checks if a url is available. Some of the features that I have added to this package is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check and print all the good, bad and unknown links in a file.&lt;/li&gt;
&lt;li&gt;Read multiple files at once.&lt;/li&gt;
&lt;li&gt;Check the availability of an URL.&lt;/li&gt;
&lt;li&gt;Give the URL to an archived version of a website.&lt;/li&gt;
&lt;li&gt;Output JSON format of a URL entered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  To install my package, please use the command
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install link-checker-tool

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g link-checker-tool

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

&lt;/div&gt;



&lt;p&gt;For more usages of my package, you can read my whole &lt;a href="https://www.npmjs.com/package/link-checker-tool"&gt;document&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I learn from this week lab
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How to release a package&lt;/li&gt;
&lt;li&gt;How to improve the workflow by tagging my release.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Unit testing your code!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Sat, 28 Nov 2020 04:25:15 +0000</pubDate>
      <link>https://dev.to/phast184/unit-testing-your-code-2b0</link>
      <guid>https://dev.to/phast184/unit-testing-your-code-2b0</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This week, we embarked on how to create a testing units and workflow using Github Actions. The testing framework I choose is "Jest" because of its popularity and simplicity for using.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to integrate "Jest"
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Firstly, we need to install by using
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev jest

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

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;package.json&lt;/code&gt;, add the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "scripts": {
    "test": "jest"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We can create the first test file by using this naming convention &lt;code&gt;checkFunctions.test.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We can easily run the test by using:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What did I learn while writing my test case:
&lt;/h3&gt;

&lt;p&gt;Well, since my test case is pretty long. Thus, I highly recommend you to have a look at my &lt;a href="https://github.com/phast184/link-checker-tool/blob/master/test/urlFunctions.test.js"&gt;test file&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have learned how to write a test unit that we can compare right from console.log&lt;/li&gt;
&lt;li&gt;I have learned to consider many options that could happen for my functions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Add Continuous Integration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Github Actions is a CI that is highly recommended. Therefore, I would like to introduce a bit about the way we set it up.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Firstly, we need to create a template to the .github/workflows directory of your repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is how the YML file looks like:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Node.js CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: npm run build --if-present
    - run: npm test
      env:
        CI: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;A CI is perfect when we want to automating all our test in a large project. However, if someone's change might break the tests, there's no way we could merge them until their changes are fixed. This way help us to save tons of resource.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Learning from the process:
&lt;/h3&gt;

&lt;p&gt;Well, this week assignment is highly educational. There are several things I could learn from the lab:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to set up a CI&lt;/li&gt;
&lt;li&gt;How to write a simple unit test&lt;/li&gt;
&lt;li&gt;How to set up a code coverage analysis so that I could write more test to cover the aspects that I might miss of a function.&lt;/li&gt;
&lt;li&gt;How to fix my functions when there are bugs while testing.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>A project contribution: unit test!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Thu, 19 Nov 2020 04:27:10 +0000</pubDate>
      <link>https://dev.to/phast184/a-project-contribution-unit-test-2fm2</link>
      <guid>https://dev.to/phast184/a-project-contribution-unit-test-2fm2</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This time I'm working on creating a minor unit test for a &lt;a href="https://github.com/aniketsharma00411/algorithmsUse"&gt;algorithm-gathering repo&lt;/a&gt;. &lt;em&gt;algorithmUse&lt;/em&gt; is a repo created for the purpose to embark on Data Structures and Algorithm. This repo contains multiple popular algorithms written in various languages.&lt;/p&gt;

&lt;h3&gt;
  
  
  What did I do?
&lt;/h3&gt;

&lt;p&gt;To encourage people to get involved to open source. The owner of the repo open an &lt;a href="https://github.com/aniketsharma00411/algorithmsUse/issues/11"&gt;issue&lt;/a&gt; in which requested contribution to create unit tests for their algorithms. &lt;/p&gt;

&lt;h3&gt;
  
  
  How did I do
&lt;/h3&gt;

&lt;p&gt;I, myself, also want to contribute. Therefore, I started to write a test for their binary search algorithm. My test is basically based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Return -1 if an array is empty&lt;/li&gt;
&lt;li&gt;Return -1 if the to-be-found element is even in an odd array&lt;/li&gt;
&lt;li&gt;Return the 0 if the element is found in the first position of an sorted array&lt;/li&gt;
&lt;li&gt;Return the index of an element in an array.&lt;/li&gt;
&lt;li&gt;Return middle - 1 if the element is found in the middle of the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Writing test helps us to have big picture when it comes to designing an algorithm.&lt;/li&gt;
&lt;li&gt;You can also check my contribution at &lt;a href="https://github.com/aniketsharma00411/algorithmsUse/pull/181"&gt;here&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Looking at internal details of a Telescope!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Tue, 17 Nov 2020 17:46:31 +0000</pubDate>
      <link>https://dev.to/phast184/looking-at-internal-details-of-a-telescope-nac</link>
      <guid>https://dev.to/phast184/looking-at-internal-details-of-a-telescope-nac</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This week, I'm working on an &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/1370"&gt;issue&lt;/a&gt; on &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;&lt;em&gt;Telescope&lt;/em&gt;&lt;/a&gt;. You might ask what &lt;em&gt;Telescope&lt;/em&gt; is? &lt;em&gt;Telescope&lt;/em&gt; is a tool written by Seneca College students and used to keep track of the process of student weekly by fetching their blog post on multiple sites such as: &lt;a href="https://dev.to/"&gt;https://dev.to/&lt;/a&gt;, &lt;a href="http://medium.com/"&gt;http://medium.com/&lt;/a&gt;,...&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the issue?
&lt;/h3&gt;

&lt;p&gt;In certain posts, pictures are scaled up beyond their natural size. Consequently, the quality of the pictures is reduced and make users uncomfortable. We have to find a way to fix it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qLPJK5qq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cnazb5kt3aq0bkjeehed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qLPJK5qq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cnazb5kt3aq0bkjeehed.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How to fix it?
&lt;/h3&gt;

&lt;p&gt;I realized this problem only happens to those posts fetched from &lt;a href="https://www.blogger.com/"&gt;https://www.blogger.com/&lt;/a&gt; because the images' width is not fully displayed in the original post.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sm5hgJbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndfvjigkdzzoun5zb1ku.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sm5hgJbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndfvjigkdzzoun5zb1ku.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And in the css file of the post, I have seen something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.telescope-post-content img {
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  padding-top: 1.5rem;
  padding-bottom: 1rem;
  width: 100%;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Due to &lt;code&gt;width: 100%&lt;/code&gt;, the pictures may get scaled beyond their natural size. To fix it, I have set &lt;code&gt;width: auto&lt;/code&gt; and &lt;code&gt;display: block&lt;/code&gt; to display width as their natural size. And if the picture's width is not fully displayed, it will be centered&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.telescope-post-content img {
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  padding-top: 1.5rem;
  padding-bottom: 1rem;
  width: auto;
  display: block;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result after change:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---mxR2b-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pjnyt1g4thzao1dvvzyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---mxR2b-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pjnyt1g4thzao1dvvzyw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges while fixing this issue
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The only difficulty I encountered while fixing this issue is the amount of time it takes to set up a proper environment to run the app. You can check my PR at &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/1373"&gt;here&lt;/a&gt; to have a closer look at the changes I made.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Enhance your code readability with Prettier and </title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Sat, 14 Nov 2020 22:10:22 +0000</pubDate>
      <link>https://dev.to/phast184/enhance-your-code-readability-with-prettier-and-2n2g</link>
      <guid>https://dev.to/phast184/enhance-your-code-readability-with-prettier-and-2n2g</guid>
      <description>&lt;h3&gt;
  
  
  Why should we add tools to our editor?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Enhance work quality.&lt;/li&gt;
&lt;li&gt;Improve work efficiency&lt;/li&gt;
&lt;li&gt;Avoid mistakes while coding so that we could save time from fixing bugs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prettier and ESLint
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://prettier.io/"&gt;Prettier&lt;/a&gt; is a code formatter which supports JS language. A code formatter helps improve code readability so that our code would be cleaner and easier to understand. Moreover, Prettier can integrate with most editors. By which, I mean it is commonly used by many programmers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eslint.org/"&gt;ESLint&lt;/a&gt; is a linter that automatically detects any silly mistakes we could make while coding. ESLint provides the ability to quickly find problems in our code. Also, it can help fix them automatically. Furthermore, to make it more flexible developers could customize the rules for ESLint.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to set up
&lt;/h3&gt;

&lt;p&gt;One of the reasons why I decided to choose those two is because they are both easy to set up which I'm about to show you.&lt;/p&gt;

&lt;h4&gt;
  
  
  Set up Prettier by using commands
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Install Prettier to your local machine &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install --save-dev --save-exact prettier&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an empty config file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;echo {}&amp;gt; .prettierrc.json&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create an &lt;code&gt;.prettierignore&lt;/code&gt; file to ignore what files we don't want to format. Normally, the content of this file is based on the one of &lt;code&gt;.gitignore&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To format all files with Prettier&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx prettier --write .&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To format a specific file or a directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx prettier --write ./src&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To read more about the installation of Prettier, please get access at &lt;a href="https://prettier.io/docs/en/install.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Set up Prettier by using commands
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;To install ESLint at your local machine:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install eslint --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, set up a configuration file:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx eslint --init&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To run ESLint for all files:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx eslint .&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To run ESLint for a specific file:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx eslint filename&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To read more about the installation of ESLint, please get access at &lt;a href="https://eslint.org/docs/user-guide/getting-started"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before and after using Prettier
&lt;/h3&gt;

&lt;p&gt;Below is a block of code before and after using Prettier so that we can see what difference it can make.&lt;/p&gt;

&lt;p&gt;Before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {checkURL, archivedURL, jsonResult} = require('../urlHelper/urlFunctions')     
const {fileInteraction} = require('../readFiles/fileInteractions')    
const {telescopeCheck} = require('../apiHandler/apiHandler')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {
  checkURL,
  archivedURL,
  jsonResult,
} = require("../urlHelper/urlFunctions");
const { fileInteraction } = require("../readFiles/fileInteractions");
const { telescopeCheck } = require("../apiHandler/apiHandler");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see, after being formatted by Prettier my code is more organized and readable.&lt;/p&gt;

&lt;h3&gt;
  
  
  How ESLint improves my code
&lt;/h3&gt;

&lt;p&gt;Usually, when writing a loop in JS, I don't declare a iterator instead I just use it like the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (i = 0; i &amp;lt; response.data.length; i++) {
    ...
      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In VSCode I can compile and run without getting any errors. However, this is one of the silly mistakes I make when coding. Thanks to ESLint I could learn to realize my behavior and fix it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5HuoYXH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zqw4dfikt9vf5vvkrnqk.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5HuoYXH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zqw4dfikt9vf5vvkrnqk.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Automate your tools
&lt;/h3&gt;

&lt;p&gt;To automate Prettier and ESLint please read at &lt;a href="https://github.com/phast184/link-checker-tool/blob/3a0617a6cb73828e879428b1724d1944385c338d/CONTRIBUTING.md"&gt;my CONTRIBUTING.md&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What I learn from this week assignment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Using tools like Prettier and ESLint helps improve my code quality a lot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to install and integrate them to my editor (VS Code).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>opensource</category>
      <category>prettier</category>
      <category>eslint</category>
    </item>
    <item>
      <title>Check Telescope posts' availability</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Mon, 09 Nov 2020 18:07:34 +0000</pubDate>
      <link>https://dev.to/phast184/check-telescope-posts-availability-3fe6</link>
      <guid>https://dev.to/phast184/check-telescope-posts-availability-3fe6</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This week, I was assigned to add a new feature to check if a post from Telescope is available for my link checker CLI. Before digging any deeper, I would like to introduce a bit about &lt;a href="https://telescope.cdot.systems/"&gt;Telescope&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;It enables us to keep track of students' work through blog posts written by Seneca College students. By fetching data from multiple blogging sites such as Medium, Dev, WordPress,.. all blog posts of students will be automatically updated to the website whenever a new post is published.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up the environment to work with Telescope.
&lt;/h3&gt;

&lt;p&gt;To run Telescope locally, it asks us to put extra effort into setting up an appropriate environment. I am required to install WSL2, Redis, Elasticsearch, and Docker before starting the work. This is probably the most challenging part of the assignment this week. Therefore, I did counter some troubles while setting up the environment.&lt;/p&gt;

&lt;p&gt;Elasticsearch not running after installation could be a thing. I had to make some diagnoses and realized my JDK was not compatible. It took me a considerable amount of time to fix it. Or I got trouble while installing the Linux subsystem since my disk was low in storage. However, these problems could be solved by doing research on Google. The point is you have to be resilient enough.&lt;/p&gt;

&lt;h3&gt;
  
  
  Coding part
&lt;/h3&gt;

&lt;p&gt;The coding part doesn't require a lot of work. I created an API handler that manages to make a GET request to the local Telescope API, and I check the availability of each URL response by the API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const telescopeCheck = (api) =&amp;gt; {
    axios.get(api)
    .then(response =&amp;gt; {
        console.log("CONNECT TO TELESCOPE SUCCESSFULLY!!!");
        console.log("====================================")

        for (i = 0; i &amp;lt; response.data.length; i++)
        {
            checkURL(api+`/${response.data[i].id}`);
        }
    })
    .catch(err =&amp;gt; console.log("Cannot connect to local API, please double check to make sure the API is initiated!!!"))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Gist it done
&lt;/h3&gt;

&lt;p&gt;Gist is a quick and instant tool that enables us to share code snippets without unnecessary work. To get technical notes between two commits, we simply use the command &lt;code&gt;git diff old_commit...new_commit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I am still not satisfied with the code snippets above. Therefore, any recommendation will be welcome. Thank you for spending your time reading my blog. &lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Hacktoberfest! Last PR! Dutch National Flag~</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Mon, 02 Nov 2020 17:20:23 +0000</pubDate>
      <link>https://dev.to/phast184/hacktoberfest-last-pr-dutch-national-flag-pde</link>
      <guid>https://dev.to/phast184/hacktoberfest-last-pr-dutch-national-flag-pde</guid>
      <description>&lt;p&gt;&lt;em&gt;Every party must come to an end.&lt;/em&gt; This is the last PR that I made for Hacktoberfest. For the first time that I realize how fun it was. To be honest, each pull request literally pulls you up.&lt;/p&gt;

&lt;p&gt;My last PR is not something big. I was just doing something ordinary my self. I worked on &lt;a href="https://en.wikipedia.org/wiki/Dutch_national_flag_problem"&gt;Dutch National Flag problem&lt;/a&gt;. The problem is there is an array consisting only 0, 1 and 2. How to sort the array in the linear time complexity.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MAYEL5aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/83j2ccmr50n9v1l7tdfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MAYEL5aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/83j2ccmr50n9v1l7tdfs.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Well, the problem did raise the curiosity in my head which makes me want to try it. Here is &lt;a href="https://github.com/aditya109/git-osp-for-beginners/pull/348"&gt;my solution&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public static void SortingArray(int a[]){
        // Count the number of zero, one
        int zeros, ones, k;
        zeros = ones = k = 0;

        for (int i = 0; i &amp;lt; a.length ; i++){
            if (a[i] == 0 )
            {
                zeros++;
            }
            if (a[i] == 1 )
            {
                ones++;
            }
        }

        // fill zero in the first positions of the array
        while(zeros-- != 0){
            a[k++] = 0;
        }

        //fill one in the next empty position
        while (ones-- != 0){
            a[k++] = 1;
        }

        // fill twos in the left positions
        while (k &amp;lt; a.length){
            a[k++] = 2;
        }
        System.out.println(Arrays.toString(a));

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

&lt;/div&gt;



&lt;p&gt;I would like to explain a bit about my way to approach the problem. To sort the array that only contains 0, 1 and 2, I first count the number of 0 and 1 in that array. Then I over-write the existing array of which the n first positions are filled with n zeros. The next m positions are filled with m ones. The left positions are filled with twos. Therefore, the array is sorted in linear time complexity.&lt;/p&gt;

&lt;p&gt;My last PR is not something significant but I would like to share it to you guys. Every &lt;code&gt;git push&lt;/code&gt; I have made is a push for me to get out of my comfort zone and started to be more proactive myself. &lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Hacktoberfest! Level 3!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Fri, 30 Oct 2020 06:03:35 +0000</pubDate>
      <link>https://dev.to/phast184/hacktoberfest-level-3-3cpn</link>
      <guid>https://dev.to/phast184/hacktoberfest-level-3-3cpn</guid>
      <description>&lt;p&gt;If you have read my previous posts, I am celebrating Hacktoberfest which is about to end in a couple of days. This post is about my third PR. In which, I helped translate README.md into my first language. You can check out my &lt;a href="https://github.com/trybick/issue-collab/pull/75#event-3935750838"&gt;PR&lt;/a&gt;.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/trybick/issue-collab"&gt;issue-collab&lt;/a&gt; is a project that helps people who want to get involved with open source but got no ideas how to start. It allows people to find issues without getting overwhelmed. I have to admit I find it one of the most useful projects during Hacktoberfest.&lt;/p&gt;

&lt;p&gt;Back to what I was working on. I am fully aware of the fact that translating is not as big as fixing a bug or something. But in comparison of my previous PR in which I only helped translate a minor file, I do make a progress this time.&lt;/p&gt;

&lt;p&gt;The more I am working with open source, the more I am enjoying it. It has given me a sense of contribution which helps build my self confidence since I am kind of introverted while working with other people due to my lack of experience.&lt;/p&gt;

&lt;p&gt;But whatever, thanks you guys for spending time my thoughts. I truly appreciate. Happy Coding!!!!&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Hacktoberfest! My second PR!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Fri, 30 Oct 2020 01:51:01 +0000</pubDate>
      <link>https://dev.to/phast184/hacktoberfest-my-second-pr-2bn7</link>
      <guid>https://dev.to/phast184/hacktoberfest-my-second-pr-2bn7</guid>
      <description>&lt;p&gt;As exciting as it is, Hacktoberfest has been held a huge interest in me even though this is the first time I have been a part of it. It takes me a decent amount of time to find what to do next for my 2nd PR since there are so many options on the markets. And we all know that the more options we have, the indecisive we might be. &lt;/p&gt;

&lt;p&gt;Therefore, picking a project to work on is always the first difficulties I have to encounter whenever I want to contribute for open source. Fortunately, I have found a repo that held my interest. It was &lt;a href="https://github.com/mdolr/survol"&gt;Survol&lt;/a&gt;, a browser extension that allows user to preview a link before clicking.&lt;/p&gt;

&lt;p&gt;And can you guess what I can contribute in the project? Well, the maintainer need to be more user friendly so that they need &lt;a href="https://github.com/mdolr/survol/issues/116"&gt;help translate their work into another language&lt;/a&gt;. Okay it is not coding but I'll take my chance any way.&lt;/p&gt;

&lt;p&gt;I used to find it difficult to comprehend English. So, I know how challenging it could be for those whose first language is not English to interact with a program. And I am proud that I could make a minor change that help improve it. I &lt;a href="https://github.com/mdolr/survol/pull/148"&gt;make a minor contribution&lt;/a&gt; that add support for Vietnamese language.&lt;/p&gt;

&lt;p&gt;Even though the change is not significant, I am happy that I'm starting to get more involved with open source. I do hope I can really make something bigger in the future even after Hacktoberfest.&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Clean your code by using Git Rebase!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Sat, 24 Oct 2020 07:37:26 +0000</pubDate>
      <link>https://dev.to/phast184/clean-your-code-by-using-git-rebase-5601</link>
      <guid>https://dev.to/phast184/clean-your-code-by-using-git-rebase-5601</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;As usual, my assignment this week is to keep improving my code's readability. In my previous commits, I always keeps all my functions under one entry point file. As a result, it would be such a struggle for me and other to maintain and understand my code efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I do
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Improvements
&lt;/h4&gt;

&lt;p&gt;I am fully aware of the inconvenience that I would end up if I don't make any improvements. So there are some changes:&lt;/p&gt;

&lt;h5&gt;
  
  
  Move all functions to separate helper files
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;All functions working with URLs will be moved to an URLs helper file.&lt;/li&gt;
&lt;li&gt;All functions interacting with files will be moved to an fileInteraction file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever I feel like using any of these functions above I would easily import it from the files. Therefore, my code structure would be way more organized and easier to maintain if there is any problem.&lt;/p&gt;

&lt;h5&gt;
  
  
  Reduce code duplication
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;All blocks of code that is used multiple times will be convert into a function. So, I can reuse them without rewriting them over again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Squash all commits into one by using &lt;code&gt;git rebase&lt;/code&gt;
&lt;/h5&gt;

&lt;h3&gt;
  
  
  Difficulties
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Sometimes we will be in trouble if I forget to import the functions after separating them since all of them are tightly connected to each other. By which, I mean fileInteraction functions sometimes call URL helper functions and we have to import them properly in order to make our app run smoothly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Knowing what to do to enhance your code performance could give you chill. However, I know so clearly that my work is still flawed and I am more than welcome if any one can suggest any improvements I could make. You could check my latest commit at &lt;a href="https://github.com/phast184/link-checker-tool/commit/c22a005e8d1998b3970dec741bf2afa8bdcdabab"&gt;c22a005&lt;/a&gt;.    &lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Hacktoberfest! The first PR!</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Thu, 22 Oct 2020 04:14:21 +0000</pubDate>
      <link>https://dev.to/phast184/hacktoberfest-the-first-pr-30hc</link>
      <guid>https://dev.to/phast184/hacktoberfest-the-first-pr-30hc</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Hacktoberfest&lt;/em&gt; is the biggest festival for opensource programmer which takes place in October every year. As a first-timer, I felt very excited to be a part of this year &lt;em&gt;Hacktoberfest&lt;/em&gt;. Therefore, I would like to write about my experience after making the first PR.&lt;/p&gt;

&lt;h3&gt;
  
  
  Difficulties
&lt;/h3&gt;

&lt;p&gt;Well, since this is my first time, I was kind of overwhelmed and strange with the number of projects there are on Github. So, I was looking for something which is:&lt;/p&gt;

&lt;h4&gt;
  
  
  Not too simple
&lt;/h4&gt;

&lt;p&gt;There are plenty of repos on Github that only ask me to add my name for my first PR. However, that is not what I was looking for since I don't want to put so little effort once I start working.&lt;/p&gt;

&lt;h4&gt;
  
  
  Not too overwhelming
&lt;/h4&gt;

&lt;p&gt;As a first-timer, due to the lack of experience, I don't want to put myself in a difficult situation which I cannot finish what I start.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Looking for the right repo to work on seems to be the first difficulties that I encountered.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The repo I have chosen
&lt;/h3&gt;

&lt;p&gt;Thanks to the recommendation of a classmate, I found a perfect repo for me to work on which is &lt;a href="https://github.com/ahampriyanshu/algo_ds_101"&gt;algo_ds_101&lt;/a&gt;. This is a collection of algorithms and data structures code written in different programming languages.&lt;/p&gt;

&lt;h4&gt;
  
  
  Issue that I worked on
&lt;/h4&gt;

&lt;p&gt;This repo is perfect for me to work on since it's not too complicated and I don't have to put so little effort in the problem. &lt;/p&gt;

&lt;p&gt;I started to make approach to &lt;a href="https://github.com/ahampriyanshu/algo_ds_101/issues/842"&gt;issue 842&lt;/a&gt; which asked to write an algorithm that counts the number of divisible pair in a array.&lt;/p&gt;

&lt;h4&gt;
  
  
  What did I need to do to prepare for the fix?
&lt;/h4&gt;

&lt;p&gt;There are not so much requirements for the issue. I only need to write a block of code in JavaScript that can count the number of divisible pair in an array.&lt;br&gt;
Let me explain a little bit about the requirement:&lt;br&gt;
if there is an array &lt;code&gt;arr[] = {1, 2, 3}&lt;/code&gt; then the two pairs are (1, 2) and (1, 3).&lt;/p&gt;
&lt;h4&gt;
  
  
  My pull request
&lt;/h4&gt;

&lt;p&gt;See, the requirement is not so hard. I believe with the basic knowledge of programming, any of us could solve this problem easily. You can have a look at my pull request at &lt;a href="https://github.com/ahampriyanshu/algo_ds_101/pull/1202"&gt;my first full request&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    for (let i = 0; i &amp;lt; n; i++) // iterate through the array from i = 0
    {
        for (let j = i + 1; j &amp;lt; n; j++) // iterate through the array start from the element next to arr[i]
        {
            if (
                (arr[i] % arr[j] == 0)  
                || (arr[j] % arr[i] == 0)
                )
                {
                    count++; // increase count by 1, if it is under the condition
                }
        }
    }
    return count;    
}
let arr = [2,3,5,8,9];
console.log(DivisiblePairCount(arr, arr.length));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;First I iterate the array from &lt;code&gt;i = 0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I put a nested loop which starts from &lt;code&gt;j = i + 1&lt;/code&gt; in the previous loop.
*Therefore, whenever an element at j is divided by an element at i or vice versa, &lt;code&gt;count&lt;/code&gt; will increase by 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Well, my first PR is as simple as it is. But it is a huge encouragement since it gives me a sense of achievement so that I could keep going until the end of &lt;em&gt;Hacktoberfest&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Remotes, Commits and Merges! Is that a long distance relationship?</title>
      <dc:creator>Thanh Tien Phat Nguyen</dc:creator>
      <pubDate>Mon, 19 Oct 2020 03:36:23 +0000</pubDate>
      <link>https://dev.to/phast184/remotes-commits-and-merges-is-that-a-long-distance-relationship-bfo</link>
      <guid>https://dev.to/phast184/remotes-commits-and-merges-is-that-a-long-distance-relationship-bfo</guid>
      <description>&lt;p&gt;This week has been such a hectic whirlwind for me. Stacks of assignments from different classes are waiting to be finished by me. But I still find it enjoying while working with opensource. Even though sometimes I find committing to others (repo) extremely difficult but I still have a butterflies while working. Maybe I'm in love...&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G1BavhTo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s7ms1hu2ll1bhrorz5m5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G1BavhTo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s7ms1hu2ll1bhrorz5m5.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Ideas of new feature
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Users want to be able to run our link checker tools and be able to include an extra argument, a file of URL patterns to be ignored. &lt;/li&gt;
&lt;li&gt;This week's feature will add the ability to exclude URLs from our check based on a URL pattern file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What I did
&lt;/h3&gt;

&lt;h4&gt;
  
  
  I filed an issue and forked the &lt;a href="https://github.com/PedroFonsecaDEV/URLpilgrim"&gt;repo&lt;/a&gt; from &lt;a href="https://github.com/PedroFonsecaDEV"&gt;Pedro's github&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;A forked repo allows me to work as an remote and modify the code as I please without interfering the original repo.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create a &lt;code&gt;readIgnoredFile&lt;/code&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const readIgnoreFiles = async (filePath) =&amp;gt; {
  const urlRegex = /(((http|https):\/\/)|(www\.))([\w+\-&amp;amp;@`~#$%^*.=\/?:]+)/gi;
  let urlList = [];

  const data = await fs.promises.readFile(filePath, "utf8");

  let check = data.startsWith("#")
  if (check) {
    urlList = data.toLowerCase().match(urlRegex);
    urlList = Array.from(new Set(urlList));
    if (urlList.length != 0)
    {
      return urlList;
    }
    else{
      let message = "There is no valid URLs in the file."
      return message;
    }
  }
  else{
    let message = "Your ignore test file is not valid."
    return message;
  }

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The code above will validate the file. If there is no comment which starts with "#", the file is invalid.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, it will return any url grabbed from the "IgnoredTestFile".&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Create a &lt;code&gt;removeAnyURLsStartwith&lt;/code&gt; function
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const removeAnyURLsStartwith = (urls, urls_condition) =&amp;gt; {
  for (let i = 0; i &amp;lt; urls_condition.length; i++){
    for (let j = 0; j &amp;lt; urls.length; j++)
    {
      if (urls[j].startsWith(urls_condition[i]))
      {
        urls.splice(j,1);
      }
    }
  }
  return urls;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This function will remove the URL that starts with any URL declared in &lt;code&gt;urls_condition&lt;/code&gt;.
For example: &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;https://www.google.com/&lt;/code&gt; is in &lt;code&gt;urls_condition&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;https://www.google.com/search?...&lt;/code&gt; will be eliminated since it starts with &lt;code&gt;https://www.google.com/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Push my work to the forked repo and ask for &lt;code&gt;merge&lt;/code&gt; from the repo owner
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;After pushing my work to the branch I created, asking for feedback and merge from the repo owner is necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Difficulties while working
&lt;/h3&gt;

&lt;h4&gt;
  
  
  On the contributor's side
&lt;/h4&gt;

&lt;h4&gt;
  
  
  There are times I find it difficult to understand other's code
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Even the code was written by me, after a while it still takes time for me understand it. Let alone other's code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  On the repo owner's side
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Manually merge branch worked by others
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The branch worked by others sometimes take years to resolve conflict.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To be honest, working with others' projects is actually interesting.&lt;/li&gt;
&lt;li&gt;I can learn from the way they code, organize their structure. Also, I can learn how people manage to approach a specific problem while I have a different one. It's like looking from different perspectives.&lt;/li&gt;
&lt;li&gt;Lastly, COMMUNICATION! COMMUNICATION! COMMUNICATION! That makes everything work.&lt;/li&gt;
&lt;/ul&gt;

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