<?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: Oumayma JavaScript Developer </title>
    <description>The latest articles on DEV Community by Oumayma JavaScript Developer  (@oumaymasghayer).</description>
    <link>https://dev.to/oumaymasghayer</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%2F723348%2F1afa5908-af42-4542-894f-0463f64b01a1.jpg</url>
      <title>DEV Community: Oumayma JavaScript Developer </title>
      <link>https://dev.to/oumaymasghayer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oumaymasghayer"/>
    <language>en</language>
    <item>
      <title>Elixir: Repeating the same function multiple times in pipe</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Fri, 04 Nov 2022 14:44:31 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/elixir-repeating-the-same-function-n-times-in-pipe-39j3</link>
      <guid>https://dev.to/oumaymasghayer/elixir-repeating-the-same-function-n-times-in-pipe-39j3</guid>
      <description>&lt;p&gt;Piping is a trade mark for elixir developers, it makes the code cleaner, easier to read and overall more organized.&lt;br&gt;
Instead of chaining function returns like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;baz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;new_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;other_function&lt;/span&gt;&lt;span class="p"&gt;()))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Piping allow us to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="n"&gt;other_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;new_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;baz&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where the data flows from up to bottom.&lt;/p&gt;

&lt;p&gt;Sometimes on our programming journey we need to perform the same function n times while piping. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Performing the same function on enum items inside a pipe:
&lt;/h2&gt;

&lt;p&gt;We have Enum of strings that we want to transform to uppercase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="n"&gt;people&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Qui"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Quo"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Qua"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;Enum&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="no"&gt;String&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;upcase&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Piping the same function multiple times on the same variable.
&lt;/h2&gt;

&lt;p&gt;For example let's say we have a struct that we want to validate the fields.&lt;br&gt;
In this case we can simplify the piping using a function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;validate_lengths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;changeset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="no"&gt;Enum&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;changeset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;validate_length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;&amp;amp;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;&amp;amp;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="n"&gt;my_struct&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;validate_lengths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Make your text input look like a password input</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Wed, 17 Aug 2022 15:49:00 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/make-any-text-input-secure-4jp9</link>
      <guid>https://dev.to/oumaymasghayer/make-any-text-input-secure-4jp9</guid>
      <description>&lt;p&gt;Ever wondered why password inputs look like ****** ,&lt;br&gt;
turns out it's because of &lt;code&gt;-webkit-text-security&lt;/code&gt; property.&lt;br&gt;
Here's how to make a simple text input look like a password input:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;

&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="nc"&gt;.pw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-text-security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;disc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="nc"&gt;.pw2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-text-security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;circle&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="nc"&gt;.pw3&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-text-security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;square&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;



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

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

&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"pw"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"secret"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"pw2"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"secret"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"pw3"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"secret"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;result :&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Froe050lelu6scwcob4tz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Froe050lelu6scwcob4tz.png" alt="inputs result"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use Jsonp in your  project.</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Sun, 20 Feb 2022 11:45:24 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/how-to-use-jsonp-in-your-project-c0m</link>
      <guid>https://dev.to/oumaymasghayer/how-to-use-jsonp-in-your-project-c0m</guid>
      <description>&lt;p&gt;The first time I heard about JSONP was when I recieved a technical assessment for a high end company. &lt;br&gt;
When I saw it, I immediately thought: what is it? why we use it? how does it work? and how do I use JSONP in my project.&lt;br&gt;
So here I will share the answer to all those questions in one place!&lt;/p&gt;
&lt;h2&gt;
  
  
  What is JSONP?
&lt;/h2&gt;

&lt;p&gt;JSONP (JSON with Padding) is a &lt;strong&gt;javascript object notation&lt;/strong&gt; it´s used to load data from the server using a script tag &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; rather than XMLHttpRequest. &lt;/p&gt;
&lt;h2&gt;
  
  
  Why we use it?
&lt;/h2&gt;

&lt;p&gt;The short answer is that it´s used to avoid Cross-Origin-Resource-Policy issues.&lt;br&gt;
While corss-domain policy blocks accesssing files, it allows accessing scripts from another domain. JSONP uses this to access data through a script tag.&lt;/p&gt;

&lt;p&gt;To achieve that, JSONP objects come wrapped in a callback function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;//JSON Example&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1234&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Rank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;//JSONP Example - In this you can call a function&lt;/span&gt;
&lt;span class="nx"&gt;functionCall&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1234&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Rank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The client (typically JavaScript) must provide a callback function to which the data is later transferred, along with any other data the client wants to send.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The data transfer is called up on the client by formulating a script call. The URL of the web service on the server is specified, supplemented by the name of the callback function. The finished "script" tag must then be injected into the DOM (Domain Object Model). This process is called "script tag injection" and triggers the data transfer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The web service on the server side takes the data, extracts the name of the callback function and uses it to bracket the server data with an appropriate function call when it is sent back .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The browser receives the server response back in the form of a script and immediately begins executing the script. Since the script consists of a function call, the "callback" function is called and this receives the data as a parameter.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How do I use JSONP in my project?
&lt;/h2&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;jsonpCallback&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;CALLBACK_FUNCTION_NAME&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetchJsonp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&amp;lt;API_URL&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;jsonpCallback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finally,
&lt;/h2&gt;

&lt;p&gt;I hope you found this article helpful, &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>jsonp</category>
      <category>json</category>
    </item>
    <item>
      <title>Set up a Dockerfile for your angular application with Nginx</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Sun, 16 Jan 2022 09:34:53 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/set-up-a-dockerfile-for-your-angular-application-with-nginx-45k1</link>
      <guid>https://dev.to/oumaymasghayer/set-up-a-dockerfile-for-your-angular-application-with-nginx-45k1</guid>
      <description>&lt;p&gt;Running your application in docker container is the first step towards production. We have to make sure that our app can build successfully , independently of our local environment.&lt;br&gt;
Bellow you can find a basic dockerfile for your angular application that uses &lt;strong&gt;nginx&lt;/strong&gt; server to render the html.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:12-alpine as build&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package.json .&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;yarn &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;apk add gettext

&lt;span class="k"&gt;RUN &lt;/span&gt;yarn build &lt;span class="nt"&gt;--base-href&lt;/span&gt;

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; nginx:latest&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build /app/dist/hr-frontend /usr/share/nginx/html&lt;/span&gt;

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 80&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above dockerfile will run your application on port 80. &lt;br&gt;
To test it, in the root of your project run:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;docker image build --tag &amp;lt;your image name&amp;gt; .&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker run -d -p 8000:80 &amp;lt;your image name&amp;gt;&lt;/code&gt; 
This command will serve your application on port 8000. The port 80 is where your application is running inside the container.&lt;/li&gt;
&lt;li&gt;Go to &lt;u&gt;localhost:8000&lt;/u&gt; .&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>docker</category>
    </item>
    <item>
      <title>Angular Best Practices</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Fri, 14 Jan 2022 16:10:55 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/angular-best-practices-2001</link>
      <guid>https://dev.to/oumaymasghayer/angular-best-practices-2001</guid>
      <description>&lt;p&gt;Working at a large company where we have plenty of web applications with continuous releases and feature improvements  taught me the value of implementing good coding practices. With such feature velocity, it is important for the team to do things the best way possible. This helps to reduce technical debt and makes scaling up much less complicated.&lt;br&gt;
Bellow I put some of angular coding standards and practices to improve your angular application performance.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Naming Conventions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;File naming:

&lt;ul&gt;
&lt;li&gt;Names of folders and files should clearly convey their intent.&lt;/li&gt;
&lt;li&gt;Names should be consistent with the same pattern in which we mention the file’s feature first and then the type, dot separated. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example &lt;code&gt;consultation.component.ts&lt;/code&gt;  or &lt;code&gt;home.component.html&lt;/code&gt;  or &lt;code&gt;auth.service.ts&lt;/code&gt; .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Class and Method naming: It is advisable to use the upper camel case style as a suffix. 
For example &lt;code&gt;DatepickerDirective&lt;/code&gt; ,  &lt;code&gt;AuthService&lt;/code&gt; ,  &lt;code&gt;onClick&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Name variables that are observables with a $ at the end. (There's a debate to use this or not, but I think it's a good way to spot observable variables easier)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Project Structure
&lt;/h3&gt;

&lt;p&gt;Creating a folder structure is an important factor we should consider before initiating our project. Our folder structure will easily adapt to the new changes during development.&lt;/p&gt;

&lt;p&gt;Keep the structure as &lt;strong&gt;flat&lt;/strong&gt; as possible. We should not create nested structures just for the sake of structures and we should only create subfolders when we feel that the contents of a folder is hard to read at a glance. Keeping the flattest structure possible also makes imports more readable&lt;/p&gt;

&lt;p&gt;Keep related code grouped. For example, keep the shared components in a folder, feature components in their feature folder, and so on.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8zrhy2vemhl71h48q7q7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8zrhy2vemhl71h48q7q7.png" alt="Angular flat folder organization"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Angular Coding Styles
&lt;/h3&gt;

&lt;p&gt;Here is a set of rules we need to follow to make our project with the proper coding standard.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Per &lt;strong&gt;file&lt;/strong&gt;, the code must not exceed &lt;strong&gt;400 lines&lt;/strong&gt; limit.&lt;/li&gt;
&lt;li&gt;Per &lt;strong&gt;function&lt;/strong&gt;, the code must not exceed &lt;strong&gt;75 lines&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Utilize custom prefixes to prevent element name collisions with components in other apps and with native HTML elements.&lt;/li&gt;
&lt;li&gt;If the values of the variables are intact, declare it with &lt;strong&gt;const&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Names of properties and methods should be in lower camel case.&lt;/li&gt;
&lt;li&gt;Always leave one empty line between imports and modules such as third party and application imports and third-party module and custom module.&lt;/li&gt;
&lt;li&gt;We shouldn’t name our interfaces with the starting capital I letter as we do in some programming languages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  4. Single Responsibility Principle
&lt;/h3&gt;

&lt;p&gt;It is very important &lt;strong&gt;not&lt;/strong&gt; to create more than one component, service, directive… inside a single file. Every file should be responsible for a single functionality. By doing this, we are keeping our files clean, readable, and maintainable.&lt;/p&gt;

&lt;p&gt;In the same way, every module, class, or function should have responsibility for a single functionality and it should encapsulate that one part.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. Lazy Loading
&lt;/h3&gt;

&lt;p&gt;Try to lazy load the modules in an Angular application whenever possible. Lazy loading will load something only when it is used. This will reduce the size of the application load initial time and improve the application boot time by not loading the unused modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app.routing.ts&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lazy-load&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nx"&gt;loadChildren&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lazy-load.module#LazyLoadModule&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Typing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Declare variables or constants with proper types other than any. This will reduce unintended problems.  For example use &lt;code&gt;id: number;&lt;/code&gt; instead of &lt;code&gt;id: any;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;let&lt;/code&gt; rather than &lt;code&gt;var&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Declare safe strings: The variable of type string has only some set of values and we can declare the list of possible values as the type. So the variable will accept only the possible values. We can avoid bugs while writing the code during compile time itself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;const&lt;/code&gt; when the variable has a constant value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. API Calls Best Practices
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Avoid having Subscriptions Inside Subscriptions
&lt;/h4&gt;

&lt;p&gt;Technically, nested subscriptions work, but it is not the most effective way. In case, you want the value to be reused in more than one observable then you can use preferable chaining options like &lt;code&gt;combineLatest&lt;/code&gt;, &lt;code&gt;withLatestFrom&lt;/code&gt;, etc rather than subscribing to one observable in the subscribe block of another observable.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;observable1$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;withLatestFrom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;observable2$&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(([&lt;/span&gt;&lt;span class="nx"&gt;res1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;res1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;res2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Isolate API Calls
&lt;/h4&gt;

&lt;p&gt;It is better to isolate API calls in one place, like in a service and use the service from the component. This way we can add logic to these calls closer to the call and independently from the component logic.&lt;/p&gt;

&lt;h4&gt;
  
  
  Unsubscribe from Observables
&lt;/h4&gt;

&lt;p&gt;When subscribing in your components to RxJS Observables, you should always unsubscribe. Otherwise, this causes unwanted memory leaks as the observable stream is open, even after destroying the component using it.&lt;/p&gt;

&lt;p&gt;You can do this in multiple ways:&lt;/p&gt;

&lt;p&gt;-Unsubscribe the component in the &lt;code&gt;ngOnDestory&lt;/code&gt; event after destroying the component&lt;/p&gt;

&lt;p&gt;-Use the &lt;strong&gt;async pipe&lt;/strong&gt; to subscribe to Observables and automatically unsubscribe in templates.&lt;/p&gt;

&lt;h4&gt;
  
  
  Subscribe in template
&lt;/h4&gt;

&lt;p&gt;Avoid subscribing to observables from components and instead subscribe to the observables from the template. Here’s why:&lt;/p&gt;

&lt;p&gt;It makes the code simpler by eliminating the need to manually manage subscriptions since async pipes unsubscribe themselves automatically. It also reduces the risk of accidentally forgetting to unsubscribe a subscription in the component, which would cause a memory leak. (This risk can also be mitigated by using a lint rule to detect unsubscribed observables.)&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 javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// template&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;textToDisplay&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// component&lt;/span&gt;

&lt;span class="nx"&gt;iAmAnObservable&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
       &lt;span class="nf"&gt;takeUntil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_destroyed$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textToDisplay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&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 javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// template&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;textToDisplay$&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// component&lt;/span&gt;

&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textToDisplay$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;iAmAnObservable&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. Reusable Component
&lt;/h3&gt;

&lt;p&gt;Components should obey the &lt;strong&gt;single responsibility principle&lt;/strong&gt;. This helps to eliminate code duplication. Components should also only deal with display logic. It is important to separate business logic from template logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Change Detection Optimizations
&lt;/h3&gt;

&lt;p&gt;Consider adding challenging calculations into the &lt;code&gt;ngDoCheck&lt;/code&gt; lifecycle hook. And if possible cache them for as long as feasible.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Use Route Guards on the Navigation
&lt;/h3&gt;

&lt;p&gt;Angular route guards are interfaces provided by angular which when implemented allow us to control the accessibility of a route based on conditions provided in class implementation of that interface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CanActivate&lt;/code&gt;: Checks whether the component can be accessed or not&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CanActivateChild&lt;/code&gt;: Checks whether the child component can be accessed or not&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CanDeactivate&lt;/code&gt;: It asks for permission to discard the changes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CanLoad&lt;/code&gt;: Checks before load feature module&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Resolve&lt;/code&gt;: It pre-fetch the route data to make sure that data-related navigation is available or not.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  11. Use environment variables
&lt;/h3&gt;

&lt;p&gt;Angular provides environment configurations to declare variables unique for each environment. The default environments are development and production. I will upload soon a tutorial on how to configure environment variables.&lt;/p&gt;

&lt;p&gt;The major benefits of using environment variables are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy configuration&lt;/li&gt;
&lt;li&gt;Better security&lt;/li&gt;
&lt;li&gt;Fewer production mistakes&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  12. Use lint rules
&lt;/h3&gt;

&lt;p&gt;Linting forces the program to be cleaner and more consistent. It is widely supported across all modern editors and can be customized with your own lint rules and configurations.&lt;/p&gt;

&lt;p&gt;One very famous and simple example of using Lint rules is to disable console logging in production simply by using &lt;code&gt;"no-console": [true, "log", "error"]&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;A more detailed tutorial on how to configure lint rules is on the way!&lt;/p&gt;

&lt;h3&gt;
  
  
  13. Documentation
&lt;/h3&gt;

&lt;p&gt;Always document the code, as much as possible. It is a good Angular practice to document methods by defining them using multi-line comments on what task the method actually performs and all parameters should be explained.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
* This is the foo function
* @param bar This is the bar parameter
* @returns returns a string version of bar
*/&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Finally, I hope you find this list helpful,
&lt;/h3&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What should be in a readme file?</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Mon, 27 Dec 2021 13:57:17 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/the-readme-file-p49</link>
      <guid>https://dev.to/oumaymasghayer/the-readme-file-p49</guid>
      <description>&lt;p&gt;A readme file is the first file a person will see when they encounter your project, so it should be briefly detailed and pretty. It gives the user (who visits your repository) a brief idea about what the project is about, what your project can do, how to run it, etc. &lt;/p&gt;

&lt;p&gt;As projects vary, we can establish that there's no one right way to structure a good README. But there is one very wrong way, and that is to not include a README at all.&lt;/p&gt;

&lt;p&gt;It is also important to note that when you're writing your project's README, it should be able to answer the &lt;strong&gt;what&lt;/strong&gt;, &lt;strong&gt;why&lt;/strong&gt;, and the &lt;strong&gt;how&lt;/strong&gt; of the project. &lt;/p&gt;

&lt;p&gt;Here you will find the basic information to add to your readme file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Title
&lt;/h2&gt;

&lt;p&gt;This is the name of the project. It describes the whole project in one sentence and helps people understand what the &lt;strong&gt;main goal&lt;/strong&gt; and aim of the project are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;p&gt;A good description should mention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The purpose of your application&lt;/li&gt;
&lt;li&gt;Links to other projects that this application might be linked to.&lt;/li&gt;
&lt;li&gt;Technologies used.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Install and Run the Project Locally
&lt;/h2&gt;

&lt;p&gt;Include the steps required to &lt;strong&gt;install&lt;/strong&gt; your project and also the required &lt;strong&gt;dependencies&lt;/strong&gt; if any.&lt;/p&gt;

&lt;p&gt;Provide a step-by-step description of how to get the development environment running.&lt;/p&gt;

&lt;p&gt;If possible provide steps to run the projects in containers including the commands used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Provide Relevant Links
&lt;/h2&gt;

&lt;p&gt;Provide a link to the application or documentation such as swagger in case of a web application of an API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up!
&lt;/h2&gt;

&lt;p&gt;There you have it, few steps to get you started with writing your first readme file.&lt;br&gt;
For more details on how to write one, &lt;a href="https://medium.com/swlh/how-to-make-the-perfect-readme-md-on-github-92ed5771c061"&gt;here's a good link to get started&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Guidelines for better Pull Requests</title>
      <dc:creator>Oumayma JavaScript Developer </dc:creator>
      <pubDate>Fri, 24 Dec 2021 15:26:24 +0000</pubDate>
      <link>https://dev.to/oumaymasghayer/guidelines-for-better-pull-requests-gj0</link>
      <guid>https://dev.to/oumaymasghayer/guidelines-for-better-pull-requests-gj0</guid>
      <description>&lt;p&gt;A pull request is a good way to propose and collaborate on changes to a repository. Writing good pull requests and having an effective workflow will increase a team’s productivity and minimize frustration. &lt;/p&gt;

&lt;p&gt;Expected benefits of a good PR:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It tends to be reviewed quickly;&lt;/li&gt;
&lt;li&gt;It reduces bug introduction into codebase;&lt;/li&gt;
&lt;li&gt;It facilitates new developers onboarding;&lt;/li&gt;
&lt;li&gt;It does not block other developers;&lt;/li&gt;
&lt;li&gt;It speeds up the code review process and consequently the product development;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Before Opening the Pull Request
&lt;/h2&gt;

&lt;p&gt;The checklist below aims to reduce the noise among the author and their reviewers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name the branch accordingly to the team’s convention.&lt;/li&gt;
&lt;li&gt;Explicit whether the Pull Request is a draft (or WIP).&lt;/li&gt;
&lt;li&gt;Go through the changed code looking for typos, irrelevant comments, debugging pieces of code, trailing whitespaces, etc.&lt;/li&gt;
&lt;li&gt;Combine multiple commits into one to make it look like a story (or a task).&lt;/li&gt;
&lt;li&gt;Rebase your branch onto master and upstream branch.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Make Smaller Pull Requests
&lt;/h2&gt;

&lt;p&gt;Making smaller pull requests is the #1 way to speed up your review time. Because they are so small, it’s easier for the reviewers to understand the context and reason with the logic.&lt;/p&gt;

&lt;p&gt;Small PRs are : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reviewed more thoroughly and quickly.&lt;/li&gt;
&lt;li&gt;Easier to merge.&lt;/li&gt;
&lt;li&gt;Less wasted work if rejected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some ideas to make it easier to make small PRs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extract refactoring to a separate PR.&lt;/li&gt;
&lt;li&gt;Split big features into parts (even if they wouldn’t be user-facing).&lt;/li&gt;
&lt;li&gt;Make &lt;code&gt;git add --patch&lt;/code&gt; your friend! ( it allows you to go through your code one more time before committing).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Clear Title and Description
&lt;/h2&gt;

&lt;p&gt;When creating a pull request you should care about the title and the description as a way to provide an overview of why the work is taking place with links to the JIRA ticket and any other relevant services.&lt;/p&gt;

&lt;p&gt;Start the description by stating the purpose of your work. Something in the lines of : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;This is a spike to explore…&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;This simplifies the display of…&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;This fixes handling of…&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not assume full familiarity with the story or work that has been done. Imagine that the code reviewer is arriving in your team today without knowing what is going on, and even so, they should be able to understand the changes. Remember that anyone in the company could be reading this Pull Request, so the content and tone may inform people other than those taking part, now or later.&lt;/p&gt;

&lt;p&gt;Mention colleagues or teams that you specifically want to involve in the discussion, and mention why. (“/cc @person for clarification on this logic. @ops, any concerns with this approach?”).&lt;/p&gt;

&lt;p&gt;For client-side changes, add some &lt;strong&gt;screenshots or gifs&lt;/strong&gt; for changes or animations.&lt;/p&gt;

&lt;p&gt;Similarly, a useful summary title (instead of just the issue key) makes it clear to the reviewer what’s being solved at a high level, which takes off one extra step for the reviewer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep the title short, but expressive enough to signal what the reviewer can expect.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Code review
&lt;/h2&gt;

&lt;p&gt;As a reviewer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prioritize PR review.&lt;/li&gt;
&lt;li&gt;Make an effort to read the description and understand how the feature works.&lt;/li&gt;
&lt;li&gt;Use positive language as opposed to neutral. (If the content is neutral, we assume the tone is negative.)&lt;/li&gt;
&lt;li&gt;Write clear comments. Describe the issue, why you don’t agree (mistakes, errors, violations against conventions, performance risk, security issues, etc.) , and propose other solutions to simplify and improve the code. Don’t be afraid to ask questions. &lt;/li&gt;
&lt;li&gt;Write good and bad comments. If you like a piece of code don’t hesitate to let the developer know!&lt;/li&gt;
&lt;li&gt;Use a checklist to try to catch any errors, bad practices.&lt;/li&gt;
&lt;li&gt;Pull the code locally to test the acceptance criteria of the feature and the performance before approving.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a developer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Two reviewers are better than one! don’t merge your code until at least 2 reviewers approve.&lt;/li&gt;
&lt;li&gt;Do not change the code while reviewing.&lt;/li&gt;
&lt;li&gt;Answer all comments and explain your point of view.&lt;/li&gt;
&lt;li&gt;A common axiom is “Don’t take it personally. The object under review is of the code, not you.” Assume the best intention from the reviewer’s comments and be aware of how hard it is to convey emotion online. If a review seems aggressive or angry or otherwise personal, consider if it is intended to be read that way and ask the person for clarification of intent, in person if possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Finally,
&lt;/h2&gt;

&lt;p&gt;To sum up, keep in mind that a good pull request is reviewed fast, which means merged fast!&lt;/p&gt;

</description>
      <category>github</category>
      <category>webdev</category>
      <category>git</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
