<?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: Goodness Chris-Ugari</title>
    <description>The latest articles on DEV Community by Goodness Chris-Ugari (@goodiec).</description>
    <link>https://dev.to/goodiec</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%2F135143%2F40ac7956-8b24-4d83-ab48-bffa8854ba4d.png</url>
      <title>DEV Community: Goodness Chris-Ugari</title>
      <link>https://dev.to/goodiec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/goodiec"/>
    <language>en</language>
    <item>
      <title>Serving the Content of your Static Websites Faster with AWS CloudFront</title>
      <dc:creator>Goodness Chris-Ugari</dc:creator>
      <pubDate>Wed, 18 Aug 2021 20:35:41 +0000</pubDate>
      <link>https://dev.to/aws-builders/serving-the-content-of-your-static-websites-faster-with-aws-cloudfront-3fbm</link>
      <guid>https://dev.to/aws-builders/serving-the-content-of-your-static-websites-faster-with-aws-cloudfront-3fbm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A static website is a website that contains web pages with fixed contents. It is made up of HTML, CSS, and JavaScript files and doesn't require any server-side processing. Your website is available worldwide through a static IP. However, if your web server is in one place, and your users are in an entirely different place it might take some seconds until your website appears and loads for your users. Delivering your static content through Amazon CloudFront could optimize delivery times for your users no matter where they are in the world. In this article, we will be going through the setup and host a static website on S3 and accessing the cached website pages using CloudFront content delivery network (CDN) service.&lt;/p&gt;

&lt;p&gt;In this guide, we will create a public S3 bucket and upload the website files to your bucket, configure the bucket for website hosting and secure it using IAM policies, speed up content delivery using AWSs content distribution network service, CloudFront, and access your website in a browser using the unique CloudFront endpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;
AWS CloudFront &lt;/li&gt;
&lt;li&gt;
AWS S3 Bucket &lt;/li&gt;
&lt;li&gt;
Create an S3 Bucket &lt;/li&gt;
&lt;li&gt;Upload Files to S3 Bucket&lt;/li&gt;
&lt;li&gt;
Secure Bucket Via IAM (Identity and Access Management) &lt;/li&gt;
&lt;li&gt;Distribute Website via CloudFront&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow along with this tutorial, you should have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account, you can create one &lt;a href="https://aws.amazon.com/free"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A static website or frontend application&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS CloudFront
&lt;/h2&gt;

&lt;p&gt;CloudFront is a service provided by Amazon.com to enable content delivery on websites. In simple terms, it means your static websites can have super-fast loading rates without spending any dime on expensive CDN services like MaxCDN, Cloudflare, or RapidScale. Your blog could even load much faster than some sites hosted on PHP or any application servers, including those that use Java, NodeJS, and many more. CloudFront offers low latency and high transfer speeds during website rendering. Being able to serve the static content of my websites from multiple edge locations around the world is fantastic. This speeds up site load times for visitors and balances that traffic flow across the Amazon CDN network. With AWS CloudFront, you can securely transfer content such as software, videos, data, and APIs to clients with high transfer speed and low latency. It will cache your content in edge locations and decrease the workload, thus resulting in the high availability of applications (Since the cache is closer to the user, the content will be delivered with minimal latency). It is simple to use and ensures productivity enhancement. It provides high security with the Content Privacy feature. It facilitates GEO targeting service for content delivery to specific end-users. It uses HTTP or HTTPS protocols for the quick delivery of content. It is less expensive, as it only charges for the data transfer.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS S3 Bucket
&lt;/h2&gt;

&lt;p&gt;Amazon S3 (Simple Storage Service) is a simple storage service designed to store data. With this service, you only pay for what you use, it has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. Buckets serve as containers for objects and provide the mechanisms necessary to control access to them, you can think of them as folders. Using an S3 bucket to store your website files has its advantages. With S3, there is no risk of over-provisioning as with traditional servers, it is easy to use, it scales automatically, integration options such as fast content serving with CloudFront, and high availability (Amazon guarantees 99.99% availability of S3 which means there is almost no chance of losing your data. S3 achieves this by replication across multiple data centers).&lt;/p&gt;

&lt;h2&gt;
  
  
  Create an S3 Bucket
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the AWS Management Console page, type S3 in the Find Services box, and then select S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GsXodU1u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475972167/YN8D-3nWi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GsXodU1u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475972167/YN8D-3nWi.png" alt="s3-search.PNG" width="845" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the S3 dashboard, click Create bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uA75lS6F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475116557/vxwfnMifn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uA75lS6F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475116557/vxwfnMifn.png" alt="create-bucket.PNG" width="880" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;General configuration&lt;/strong&gt; section, enter a Bucket name and a region of your choice. &lt;em&gt;Note: Bucket names must be globally unique.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_7P-ubm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475158693/7AQipWJlH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_7P-ubm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475158693/7AQipWJlH.png" alt="gen-config.PNG" width="847" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Bucket settings, in &lt;strong&gt;Block Public Access&lt;/strong&gt; section, uncheck the Block all public access. It will disable the &lt;strong&gt;Block all public access&lt;/strong&gt; feature to the bucket objects via the S3 object URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FRglaEIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475178676/R6v4eXTQu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FRglaEIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475178676/R6v4eXTQu.png" alt="public-access.PNG" width="735" height="588"&gt;&lt;/a&gt;&lt;em&gt;Note - We are allowing the public access to the bucket contents because we are going to host a static website in this bucket. Hosting requires the content should be publicly readable. You will see a warning notice that turning off block all public access might result in this bucket and the objects within becoming public, tick the checkbox in that section to acknowledge that that is what you want to do.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Leave the rest of the settings as they are and click on the "Create Bucket" button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After the bucket has been created, click on the bucket name to open the bucket to the content area. Since you just created the bucket, there are no contents in it yet.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Upload Files to S3 Bucket
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In the bucket content area, click on the "Upload" button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ui0Ber2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475230625/DdUTrwvoN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ui0Ber2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475230625/DdUTrwvoN.png" alt="emp-content.PNG" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the "Add files" and Add folder buttons, and upload your website file contents from your local computer to the S3 bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hn-36C09--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475251632/_kzaP9VJP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hn-36C09--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475251632/_kzaP9VJP.png" alt="add-files.PNG" width="858" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note - Use the "Add files" button to add files, not in a folder, and use the "Add folder" button to add folders(for example a folder containing the project images). Do not upload the entire project at once by uploading the top project folder, that won't work. Open your project folder on your local computer and upload folders as folders and files as files.&lt;/em&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uzMMle7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475274309/Vcf0uHc-zK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uzMMle7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475274309/Vcf0uHc-zK.png" alt="proj-files.PNG" width="670" height="475"&gt;&lt;/a&gt;The above is the structure of my project files and I want to make sure that after uploading them to the S3 bucket that they appear just as they do on my local computer.&lt;/p&gt;

&lt;p&gt;-After selecting the files, you still need to click another "Upload" button at the bottom of the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZyBtp3OG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475331910/omEdM3IfM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZyBtp3OG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475331910/omEdM3IfM.png" alt="upload-2.PNG" width="880" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After the files have been uploaded, you will be notified if it was successful, you can then click on "Close" to go back to that particular S3 bucket dashboard where you will see the folder(s) and files you uploaded. Confirm that they are in the right order and that your index.html file is in the root folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eGIiLv1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475365452/RyanJNl_R.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eGIiLv1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475365452/RyanJNl_R.png" alt="suceed.PNG" width="880" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DhuMPDg6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475472782/MIHKYlnze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DhuMPDg6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475472782/MIHKYlnze.png" alt="confirm.PNG" width="880" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Secure Bucket Via IAM (Identity and Access Management)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;From the dashboard of the bucket you created, click on the Permissions tab. Confirm that the bucket allows public access for hosting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TKClmh1h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475552420/eM5PHMhEVQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TKClmh1h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475552420/eM5PHMhEVQ.png" alt="perm1.PNG" width="880" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Still in the permissions area, scroll down to the &lt;strong&gt;Bucket policy&lt;/strong&gt; section. You should see that it is empty, click on the "Edit" button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cofUHAHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475551959/xRgqc6GTO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cofUHAHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475551959/xRgqc6GTO.png" alt="perm2.PNG" width="880" height="398"&gt;&lt;/a&gt;-Enter the following bucket policy and replace "" with the name of your bucket and click "Save changes" at the bottom of the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"Version":"2012-10-17",
"Statement":[
 {
   "Sid":"AddPerm",
   "Effect":"Allow",
   "Principal": "*",
   "Action":["s3:GetObject"],
   "Resource":["arn:aws:s3:::&amp;lt;bucket_name&amp;gt;/*"]
 }
]
}

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0RWeBxpN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475576518/W3O7oJBjk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0RWeBxpN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475576518/W3O7oJBjk.png" alt="S3 Management Co.png" width="880" height="736"&gt;&lt;/a&gt;-After the policy has been changed, you will be redirected back to the permissions area.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note - If we had made the bucket private, we wouldn't have to specify any bucket access policy explicitly. In such a case, once we set up the CloudFront distribution, it will automatically update the current bucket access policy to access the bucket content. The CloudFront service will make this happen by using the Origin Access Identity user.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the Properties tab and then scroll down to the &lt;strong&gt;Static website hosting&lt;/strong&gt; section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R5RGXJo1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475684947/C0EaZ1bWk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R5RGXJo1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475684947/C0EaZ1bWk.png" alt="prop.PNG" width="880" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the Edit button to see the &lt;strong&gt;Edit static website hosting&lt;/strong&gt; screen. Now, enable the &lt;strong&gt;Static website hosting&lt;/strong&gt; , and provide the default home page and error page for your website. For my project, the index page or homepage is in the index.html file so I input that in the "index document field", I also inputted index.html in the "error document" field for testing purposes but you can either leave it blank as it is optional or put the document there also. After inputting those, click on "Save changes"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6enkFUJW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475742836/cXtH5dLzU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6enkFUJW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475742836/cXtH5dLzU.png" alt="prop1.PNG" width="880" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you notice that enabling static website hosting requires you to make your bucket public? In the snapshot above, it says "For your customers to access the content at the website endpoint, you must make all your content publicly readable."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yWvRvrKh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475786984/NOd7iJ5-a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yWvRvrKh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475786984/NOd7iJ5-a.png" alt="static.PNG" width="880" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After successfully saving the settings, scroll down to the &lt;strong&gt;Static website hosting&lt;/strong&gt; section again in the Properties area and you should now be able to view the &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteEndpoints.html"&gt;website endpoint&lt;/a&gt; as shown below:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_kQBk2Ex--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475910737/EFsd_QU11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_kQBk2Ex--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475910737/EFsd_QU11.png" alt="endpoint.PNG" width="880" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribute Website Via CloudFront
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;From the search field at the top of your AWS console, search for "CloudFront" and select "CloudFront" in the search results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nD6QgZAg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475938979/lz8QKKMLi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nD6QgZAg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475938979/lz8QKKMLi.png" alt="search-cloudfront.PNG" width="845" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From the CloudFront dashboard, click Create Distribution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IwAeWWQ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475999668/XzQWIhnoa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IwAeWWQ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622475999668/XzQWIhnoa.png" alt="create-distribution.PNG" width="880" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the new page, for Select a delivery method for your content, click Get Started.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L-FcBFHl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476026887/CRVfolqDO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L-FcBFHl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476026887/CRVfolqDO.png" alt="delivery-method.PNG" width="880" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill the &lt;strong&gt;Create Distribution&lt;/strong&gt; settings form, under &lt;strong&gt;Origin Settings&lt;/strong&gt; , in the "Origin Domain Name", select the S3 bucket you created earlier. In the "Origin Path" field, enter "/" to indicate the root level. For the "Restrict Bucket Access", select "Yes", for "Origin Access Identity" select "Create a New Identity" (Allow access to the S3 content using CloudFront URL ), for "Grant Read Permission on Bucket", select "Yes, Update Bucket Policy".&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Default Cache Behavior Settings&lt;/strong&gt; , in the "Viewer Protocol Policy", select "Redirect HTTP to HTTPS".&lt;/li&gt;
&lt;li&gt;In the "Distribution Settings", for the "Default Root Object" input "index.html" (This file residing at the root level, will be the default landing page).&lt;/li&gt;
&lt;li&gt;Leave the defaults for the rest of the options and fields and you should have something as seen below: &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dylf9Api--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476051541/0kPjAJQrm.png" alt="create-dist1.PNG" width="880" height="370"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hsdwSLYL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476095381/cWW6s9VJ6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hsdwSLYL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476095381/cWW6s9VJ6.png" alt="create-dist2.PNG" width="880" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nB6EOGLo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476109934/skI9OB5p3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nB6EOGLo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476109934/skI9OB5p3.png" alt="create-dist3.PNG" width="880" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zihA3DnH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476121640/1saGMUEy-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zihA3DnH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476121640/1saGMUEy-.png" alt="create-dist4.PNG" width="880" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aGyGSCz2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476134855/ykg6Md5FQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aGyGSCz2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476134855/ykg6Md5FQ.png" alt="create-dist5.PNG" width="880" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note - the Grant Read Permission on Bucket says that Yes, update access bucket policy automatically to allows the Origin Access Identity user access to the bucket content. Origin Access Identity user represents the CloudFront service.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After confirming your values, click on the "Create Distribution". It may take up to 10 minutes for the CloudFront Distribution to get created.&lt;/li&gt;
&lt;li&gt;Go back to your distributions page. Once the status of your distribution changes from In Progress to Deployed, copy the endpoint URL for your CloudFront distribution found in the Domain Name column and append ".cloudfront.net" to it in your browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HmvLA5Dh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476182649/_6GwGtR5O.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HmvLA5Dh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476182649/_6GwGtR5O.png" alt="dname.PNG" width="880" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also access the website via website-endpoint, such as "http://.s3-website.us-east-2.amazonaws.com" and using the S3 object URL such as "https://.s3.us-east-2.amazonaws.com/index.html". All three links: CloudFront domain name, S3 object URL, and website-endpoint will show you the same index.html content.&lt;/p&gt;

&lt;p&gt;If we were not "hosting" the website on S3, we could have made the bucket private and host the content only through the CloudFront domain name. In such a case, the S3 object URL and website-endpoint couldn't access the private content.&lt;/p&gt;

&lt;p&gt;Checking that it works: &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KFdUsRbV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476303874/tDmSFmf9M.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KFdUsRbV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622476303874/tDmSFmf9M.png" alt="output.PNG" width="880" height="450"&gt;&lt;/a&gt;&lt;em&gt;Accessing my static page using the CloudFront domain name. Yay! 🎉🎉🎉&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;You can see how easy it is to host a static website using services and also serve the contents of static websites faster using AWS CloudFront. Hope you found this guide useful and that you learnt something new.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/cloudfront/"&gt;https://aws.amazon.com/cloudfront/&lt;/a&gt; &lt;a href="https://adamtheautomator.com/aws-s3-static-ssl-website/"&gt;https://adamtheautomator.com/aws-s3-static-ssl-website/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding CSS Position Property</title>
      <dc:creator>Goodness Chris-Ugari</dc:creator>
      <pubDate>Tue, 20 Jul 2021 18:03:03 +0000</pubDate>
      <link>https://dev.to/goodiec/understanding-css-position-property-1eo8</link>
      <guid>https://dev.to/goodiec/understanding-css-position-property-1eo8</guid>
      <description>&lt;p&gt;CSS positioning can be a bit confusing for beginners but once they get the hang of it, they will realize that it offers them so much flexibility with the placement of their elements. In this article, I will try to explain the CSS position property and its values as clearly as I can to help you get a better grasp of them and how they affect your elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
Introduction &lt;/li&gt;
&lt;li&gt;
Static Positioning &lt;/li&gt;
&lt;li&gt;
Relative Positioning &lt;/li&gt;
&lt;li&gt;Absolute Positioning&lt;/li&gt;
&lt;li&gt;
Fixed Positioning &lt;/li&gt;
&lt;li&gt;Sticky Positioning&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are three (3) rules that determine how things get rendered on the screen or just based on your HTML code by default:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Block elements take up 100% of the page width while their height is determined by the content, so your content is the first thing that determines how large your elements get displayed.&lt;/li&gt;
&lt;li&gt;The default layout or order of elements on the screen is determined by your HTML code. &lt;/li&gt;
&lt;li&gt;Children sit on parents. For example, if you have an h1 in a div, you can say the h1 is on top of the div. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use the CSS position property to position elements on the screen the way you want them to instead of going along with the default layout and in most cases, you are going to want to make changes. CSS position is usually used with the co-ordinate properties (top, left, right, bottom). The position property can take five (5) values and we will go through each of them in this article.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Note - The co-ordinate properties only work on elements that have any of the position properties except the static position declared on them.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Static Positioning
&lt;/h2&gt;

&lt;p&gt;All HTML elements are static by default and static means go along with the rules and keep to the default HTML flow. From the pen below, you can see that adding the position property with a value of static to the divs doesn't change the default positions of the elements.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Goodiec/embed/YzVQpyj?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Relative Positioning
&lt;/h2&gt;

&lt;p&gt;Relative positioning allows you to position the selected element relative to how it would have been positioned by default or if it was given a position of static. Say you give an element a position of relative and then left of 50px, you are saying the element should move or be pushed 50px away from where it would have been positioned, it is like adding a margin of 50px between the left of the element and where it was initially positioned or say you give the element property of right 100px, it is the margin between the previous right edge of where the edge of the element used to be and its current right edge of 200px relative to where it should be. When you move an element that has a relative position, it doesn't affect the position of anything else on the screen, it is as if the old position was kept or still being maintained and everything else just flows around it as if it was never moved. All the other elements keep their positions, they will not be adjusted to fit into any gap left by the element. as is illustrated in the pen below. When you give an element a position of relative, it does nothing until you add at least one of the left, right, top or bottom properties to the element. Setting the top, right, bottom, and left properties of a relatively positioned element will cause it to be adjusted away from its normal position.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Goodiec/embed/qBmjqxy?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Absolute Positioning
&lt;/h2&gt;

&lt;p&gt;Say we have an image in a div and the div has a position of relative, if we give the image an absolute position and a right property of 50px, it's not going to shift left by 50px, it's going to shift to the right of the screen and this is because, with absolute positioning, we are positioning the element relative to its parent. The right property of 50px will give the element a right margin of 50px from the right of its parent which is a div in this case. An element with position absolute is positioned relative to the nearest positioned ancestor, however, if an absolute positioned element has no positioned ancestors, it is positioned relative to the body. A positioned element is one whose position is anything except static. You can use absolute positioning to place an element exactly where you want in its parent. Unlike relative, using absolute positioning affects the flow of your HTML, it is like the element is removed from the HTML flow.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Goodiec/embed/LYyLbrg?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixed Positioning
&lt;/h2&gt;

&lt;p&gt;If you give an element a fixed position and a left, right, top or bottom property, if you scroll, the element will not move but stay fixed to the position relative to the body of the website or page. Fixed positioning is useful if you have a navigation bar or sidebar that you want to stay fixed. An element with position fixed is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. A fixed element does not leave a gap in the page where it would normally have been located.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Goodiec/embed/jOmwVpV?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Sticky Positioning
&lt;/h2&gt;

&lt;p&gt;An element with a position sticky is positioned based on the user's scroll position. A sticky element toggles between relative and fixed, depending on the scroll position of the browser window. Note that you have to give the element at least one of the left, right, top or bottom properties for it to behave as expected else the element will take on the behavior of a relatively positioned element.&lt;br&gt;&lt;br&gt;
The sticky property is a combination of relative and fixed which keeps an element relative until a position condition is met. Say you give a div a position of sticky and a top property of 50px, the element will be positioned relatively until you scroll to a point in the viewport where the element is 50px from the top, then it becomes fixed.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Goodiec/embed/YzVQpRM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;I hope this article has helped you understand positioning in CSS better. Keep winning!&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position"&gt;MDN Web Docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://twitter.com/goodnesschris"&gt;Twitter&lt;/a&gt; | &lt;a href="https://github.com/goodiec"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>10 Platforms to Help Level Up Your Frontend Development Skills</title>
      <dc:creator>Goodness Chris-Ugari</dc:creator>
      <pubDate>Wed, 02 Jun 2021 07:34:27 +0000</pubDate>
      <link>https://dev.to/goodiec/10-platforms-to-help-level-up-your-frontend-development-skills-455p</link>
      <guid>https://dev.to/goodiec/10-platforms-to-help-level-up-your-frontend-development-skills-455p</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You will agree with me that getting out of tutorial hell can be difficult especially when you are learning on your own. Trying to apply the knowledge gained will increase the rate at which you learn and retain the knowledge. In this article, I will talk about a few resources or platforms that can help you start practicing and improving your frontend skills by working on projects. These resources will help reinforce what you've been learning from tutorials and help you level up as a frontend developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.  &lt;a href="https://www.frontendmentor.io" rel="noopener noreferrer"&gt;Frontend mentor&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;One great thing about this platform is that it provides you with the design and resources you need to build out a project saving you the stress of having to come up with designs and resources on your own so you can just focus on just implementing the design. Another great thing about this platform is that the challenges are organized or grouped by difficulty level so you can start from the &lt;strong&gt;newbie&lt;/strong&gt; challenges and go up to the &lt;strong&gt;guru&lt;/strong&gt; challenges. So this platform is not just for beginners as you can keep coming back here to practice and reinforce your learning as you learn new things. You get to use HTML, CSS, JavaScript, frameworks(such as React, Vue, etc), interact with APIs, and much more. New challenges get added frequently so you can also find something to work on this platform, share your solution and get feedback from others. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; - There are premium and free challenges but the free challenges are still really good so you don't have to purchase the premium service to get the most of this platform.&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%2Fbxl4rod6u49u0ajvtaqz.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%2Fbxl4rod6u49u0ajvtaqz.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2.  &lt;a href="https://www.frontendpractice.com" rel="noopener noreferrer"&gt;Frontend Practice&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This is a really good platform where instead of taking up these fictional projects and try to build them up like frontend mentors where you are building projects from scratch. With this, you get a list of websites that look really nice and you are encouraged to clone them. The focus is not on the entire project but some of the pages of the sites are focused on and the features on these pages are also highlighted and you are also encouraged to work on these to improve your skills. Cloning sites is a great way to learn because you learn a lot by trying to do something that someone else has already done. Another advantage of working with an actual site is that you can experience all the little interactions and there's no guessing and you try to make sure that your implementation matches it as much as possible. You can take all the skills you have been acquiring over time and put them to use and this way you will learn a lot and reinforce these skills.&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%2Ficr9grpf7ynpwfa4z25f.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%2Ficr9grpf7ynpwfa4z25f.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3.  &lt;a href="https://cssbattle.dev" rel="noopener noreferrer"&gt;CSS Battle&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This doesn't involve building actual projects but is mainly focused on helping you improve your CSS skills by working on challenges. You will be building unrealistic things or doing things that are out of the ordinary. You would be surprised how doing these things could help you fix or do something in a real-world situation. On this platform, you will have to replicate a given target in the least code possible. The lesser the amount of code used the higher your score. &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%2F9yp8mvcs59n6su4sw5v9.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%2F9yp8mvcs59n6su4sw5v9.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.  &lt;a href="https://stylestage.dev" rel="noopener noreferrer"&gt;Style Stage&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;On this platform, a base HTML file is provided for you to restyle and submit a different stylesheet for it. &lt;br&gt;
With the guidelines requiring you to follow accessibility rules, you will not just be creating a project that looks good but one that is accessible also. You submit this via a pull request and you will be told if changes need to be made to your submission and you keep doing this until your submission passes the requirements and then your project can go live. This platform is mainly for developing your CSS skill as you would just be working on the CSS files.&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%2Ft4sfjpja36dfjb15a9ye.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%2Ft4sfjpja36dfjb15a9ye.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.  &lt;a href="https://www.codewars.com" rel="noopener noreferrer"&gt;Codewars&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Unlike CSS battles, this platform provides challenges in a variety of languages. This platform is not mainly focused on visual challenges but coding challenges. You can take advantage of this platform to build up and sharpen your skills to actually building a project. A good platform that can help you to practice your problem-solving skills. CodeWars is a good platform to practice your JavaScript skills as a front-end developer.&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%2Fr5svumr5yqhxahis8vfc.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%2Fr5svumr5yqhxahis8vfc.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6.  &lt;a href="https://devchallenges.io" rel="noopener noreferrer"&gt;Dev challenges&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This platform is similar to frontend mentors as you get different challenges grouped by their level of difficulty and the challenges are further grouped into three paths, Responsive web developer, front-end developer, and full-stack developer paths. So as a frontend developer, you can focus on the first two paths and build out the projects in those categories. They have eight(8) projects in each category. You get to use Github for the submission and you can give feedback on other people's submissions also. &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%2Farko59u6zpfwfs16jogo.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%2Farko59u6zpfwfs16jogo.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7.  &lt;a href="https://www.codewell.cc" rel="noopener noreferrer"&gt;Codewell&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Improve your HTML and CSS skills by implementing real design templates on this platform. On this platform, you don't get access to the Figma file with a free account but you get access to the project assets so you can still take advantage of this platform with a free account. &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%2F5ujnuqn4gdwp813blcbp.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%2F5ujnuqn4gdwp813blcbp.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8.  &lt;a href="https://frontloops.io" rel="noopener noreferrer"&gt;Frontloops&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This is a paid platform, so to get access to the challenges. The challenges on this platform are categorized into two, Markup which is to improve your HTML and CSS skills, and Elements which is to improve your JavaScript skill. With this platform, you get 30 challenges with their assets for practicing, 30 code solutions(1st solution free), technical hints, and advice. You have to pay a one-time fee of about $19 to get lifetime access to the challenges and their resources for any of the categories you want.&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%2Fuqaj9kz0xlewzcfpamkl.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%2Fuqaj9kz0xlewzcfpamkl.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  9.  &lt;a href="https://www.dailyui.co" rel="noopener noreferrer"&gt;Daily UI&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This platform is mainly for UI(User Interface) and UX(User Experience) designers but frontend developers can take advantage of this resource by signing up to receive daily emails of different designs for 100 days but instead of creating the design using a design tool like a designer would, a frontend developer can implement the design using code.&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%2Fln7x5z98m4um1chmr5qp.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%2Fln7x5z98m4um1chmr5qp.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  10.  &lt;a href="https://www.acefrontend.com" rel="noopener noreferrer"&gt;Ace Front End&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This platform offers you access to a few practical coding challenges. It is a great platform for preparing for frontend interviews as it contains a detailed walk-through of an interview solution. You can still use this platform even though you are not preparing for an interview.&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%2F1nmfo2c7myl9a7npxs6u.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%2F1nmfo2c7myl9a7npxs6u.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;A proven way to get better at coding is by doing and these resources can help you do just that. Do not try to use them all at the same time, you can just start with one or two that best suit you, the level you are in your coding journey, and what you are trying to accomplish and try to be consistent at it by sharing your work or learning in public.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>css</category>
      <category>resources</category>
      <category>beginnner</category>
    </item>
    <item>
      <title>Beginners Guide to Shell Scripting</title>
      <dc:creator>Goodness Chris-Ugari</dc:creator>
      <pubDate>Mon, 01 Mar 2021 23:27:41 +0000</pubDate>
      <link>https://dev.to/goodiec/beginners-guide-to-shell-scripting-2mf3</link>
      <guid>https://dev.to/goodiec/beginners-guide-to-shell-scripting-2mf3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This tutorial will introduce you to scripting in a Bash shell, its structure, and how you can get started with it. In this tutorial, I assume that you are already familiar with or have some knowledge of the shell and Linux commands. If you don't, I found a really nice &lt;a href="https://toyino.hashnode.dev/linux-commands-the-basics-i"&gt;article&lt;/a&gt; on Linux commands by &lt;a href="https://hashnode.com/@ToyinO"&gt;ToyinO&lt;/a&gt;, you can check it out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is a Shell Script&lt;/li&gt;
&lt;li&gt;
Structure of a Shell Script &lt;/li&gt;
&lt;li&gt;
Using Variables &lt;/li&gt;
&lt;li&gt;
Basic Operators &lt;/li&gt;
&lt;li&gt;
Shell functions &lt;/li&gt;
&lt;li&gt;Conditional Statements for Shell Scripts&lt;/li&gt;
&lt;li&gt;
Conclusion &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is a Shell Script
&lt;/h2&gt;

&lt;p&gt;A shell script is a command-line program that contains a series of commands that are executed by an interpreter. It is usually a plain text file that can contain a series of commands that will be run or executed by the Unix/Linux shell one after the other or sequentially. A shell script is great for automating tasks, it can help save time and increase productivity. If you have to repeatedly run a series of commands often, whether simple or complex to accomplish a task, then you can and probably should write a shell script for that task. You can put any command that you can type and run on the command line in a shell script and vice versa. Before you can run a script, you need to have execute permission for that script. You can name your script whatever you like but it is advisable that it be descriptive. You can add an extension on .sh to the name of the script but this is just so that it is clear to everyone that it is a script file, with Linux being an extensionless system, the script will still run without the .sh extension. Shell scripts can be used to automate tasks such as daily backups, installation of packages on multiple servers, troubleshooting, and so on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure of a Shell Script
&lt;/h2&gt;

&lt;p&gt;The first line of a shell script should indicate the interpreter that will be used to execute the script, in this case, I am using Bash. This line starts with something called &lt;strong&gt;Shebang&lt;/strong&gt; , which is a # sign followed by an exclamation mark (!). The Shebang is then followed by the path to the interpreter.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Note - there are no spaces in the Shebang line.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

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

&lt;/div&gt;



&lt;p&gt;After the Shebang line, you can have comments describing what the script does, the name of the author, and even the day it was created. Anything following a # sign is a comment and is not being executed by the interpreter with exception of the Shebang line. Comments are optional but it is a good practice to include comments in your scripts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Name of Script: test.sh
# A simple bash script to illustrate some basic concepts
# Author: Goodness Chris-Ugari
# Date: 16-02-2021

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

&lt;/div&gt;



&lt;p&gt;After the comments at the file header with details of the script, you can then have your series of commands to be executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# Name of Script: test.sh
# A simple bash script to illustrate some basic concepts
# Author: Goodness Chris-Ugari
# Date: 16-02-2021

# Display Hello, World
echo Hello, world

# Display the present/current working directory
pwd

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

&lt;/div&gt;



&lt;p&gt;To run the script above, you type out the path to the file and press enter. In this case, it would be &lt;code&gt;./test.sh&lt;/code&gt;, assuming that the script is located in our present working directory. When run the above script will print out "Hello, World" to the command line and print out your present working directory on a new line.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gz_7vG7l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1613510530635/MmMU4BMhz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gz_7vG7l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1613510530635/MmMU4BMhz.png" alt="output1.png" width="880" height="110"&gt;&lt;/a&gt;&lt;em&gt;Demonstrating the running of a script&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Variables
&lt;/h2&gt;

&lt;p&gt;Variables are named storage locations. They are are used when you need to store a particular that you can use later. You can declare a variable and assign a value to it in Bash script. The format for declaring a variable is &lt;code&gt;VARIABLE_NAME=value&lt;/code&gt; without spaces on both sides of the declaration. A variable name can be made up of uppercase letters, lowercase letters or a combination of both but remember that Bash is case sensitive. After declaring a variable, you refer to it using the dollar sign ($) followed by the variable name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Declare a variable NAME and assign a value to it.
MOOD=Excited!

# Display "I am Excited!"
echo I am $MOOD

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

&lt;/div&gt;



&lt;p&gt;I am sure you can guess what the above code would print, &lt;code&gt;I am excited!&lt;/code&gt;, that's right! Note that you should use double quotes around complex variable values, like those that contain spaces as Bash uses space to separate items. For example &lt;code&gt;MOOD=very excited!&lt;/code&gt; would return an error when the variable $MOOD is used but if we do this &lt;code&gt;MOOD="very excited"&lt;/code&gt; would work as it should.&lt;/p&gt;

&lt;h3&gt;
  
  
  Command Substitution
&lt;/h3&gt;

&lt;p&gt;You can assign the output of a command (What would have been printed on the screen) to a variable, this is known as &lt;strong&gt;command substitution&lt;/strong&gt;. To do this, place it within brackets preceded by the $ sign.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#The code below will return the number of entries in a directory.
dirContents=$(ls | wc -l)
echo The number of entries in this directory is $dirContents

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Special Variables
&lt;/h3&gt;

&lt;p&gt;Special or positional variables are variables that are automatically set for you in Bash. Here are some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$0 - This contains the name of the script.&lt;/li&gt;
&lt;li&gt;$n - These contain command-line arguments with which a script was called. For example, $1 contains the first argument, $2, the second argument, and so on. &lt;/li&gt;
&lt;li&gt;$# - This contains the number of command-line arguments given to the script&lt;/li&gt;
&lt;li&gt;$* - All the command line arguments.&lt;/li&gt;
&lt;li&gt;$? - The exit status of the last executed command or most recently run script. An exit status of 0 means success while 1 means failure.&lt;/li&gt;
&lt;li&gt;$$ - The process ID of the current script&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Basic Operators
&lt;/h2&gt;

&lt;p&gt;In bash, you have access to arithmetic, relational, boolean, string and file test operators.&lt;/p&gt;

&lt;h3&gt;
  
  
  Arithmetic Operators
&lt;/h3&gt;

&lt;p&gt;| Operator | Description | Usage |&lt;br&gt;
| + | Addition | num1 + num2 |&lt;br&gt;
| - | Subtraction | num1 - num2 |&lt;br&gt;
| * | Multiplication | num1 * num2 |&lt;br&gt;
| / | Division | num1 / num2 |&lt;br&gt;
| % | Modulus | num1 % num2 |&lt;br&gt;
| = | Assignment | $num = value |&lt;/p&gt;

&lt;p&gt;You can use arithmetic operators in bash scripts by using in a few ways, using the &lt;code&gt;let&lt;/code&gt; or the &lt;code&gt;expr&lt;/code&gt; keyword, using the square brackets or double bracket preceded by the $ sign. You can't just try to perform arithmetic operations by typing out the numbers with an arithmetic operator. Try typing &lt;code&gt;1 + 2&lt;/code&gt; or &lt;code&gt;1+2&lt;/code&gt; in the command line and you will see that it returns an error. If you try to echo them like so &lt;code&gt;echo 1 + 2&lt;/code&gt; or &lt;code&gt;echo 1+2&lt;/code&gt;, they get treated as strings and will be displayed as &lt;code&gt;1 + 2&lt;/code&gt; and &lt;code&gt;1+2&lt;/code&gt; respectively. Study the code snippet below to understand how they are being used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

#
let myVariable=2+3 #If you are declaring the expression without quotes, then you must ensure that the expression doesn't contain spaces.
echo $myVariable #This will output 5

#Using the let command
let "myVariable = 2 + 3" #You can have spaces within quotes.
echo $myVariable # This will output 5

let myVariable++ #Will increment the last value of $myVariable, so $myVariable will now be 6

#Using the expr command
expr 2 + 3 #You must include space when using the expr command and do not enclose the expression in quotes. This line will output the addition of the two numbers.

expr "2 + 3" #Will be treated as a string and will output 2 + 3
expr 2+3 #Will be treated as a string and will output 2+3

#Using brackets
echo $[2+3] #Will work with or without spaces and output the addition of the numbers.
echo $((2+3)) #Will also work with or without spaces.

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note - with the &lt;code&gt;let&lt;/code&gt; command, you have to save the result to a variable while the &lt;code&gt;expr&lt;/code&gt; command outputs the result.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Relational Operators
&lt;/h3&gt;

&lt;p&gt;| Operator | Description | Usage |&lt;br&gt;
| -eq | Equal to | $num1 -eq $num2 |&lt;br&gt;
| -ne | Not equal to | $num1 -ne $num2 |&lt;br&gt;
| -gt | Greater than | $num1 -gt $num2 |&lt;br&gt;
| -lt | Less than | $num1 -lt $num2 |&lt;br&gt;
| -ge | Greater than or equal to | $num1 -ge $num2 |&lt;br&gt;
| -le | Less than or equal to | $num1 -le $num2 |&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note - these do not work for string values&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Boolean
&lt;/h3&gt;

&lt;p&gt;| Operator | Description | Usage |&lt;br&gt;
| ! | Negation | ! |&lt;br&gt;
| -o | Logical OR | conditon1 -or condition2 |&lt;br&gt;
| -a (&amp;amp;&amp;amp;) | Logical AND | condition1 -a condition2 |&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note - You can also use || to represent Logical OR and &amp;amp;&amp;amp; to represent Logical AND.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  String Operators
&lt;/h3&gt;

&lt;p&gt;| Operator | Description | Usage |&lt;br&gt;
| = | Equal to; Will return true if the strings match | $string1=string2 |&lt;br&gt;
| != | Not equal to; Will return true if the strings do not match | $string1!=$string2 |&lt;br&gt;
| -z | Checks if a given string operand size is zero (0).&lt;br&gt;&lt;br&gt;
Returns true if it is zero length | -z $string |&lt;br&gt;
| -n | Checks if given string operand size is non-zero | -n $string |&lt;/p&gt;
&lt;h3&gt;
  
  
  File Test Operators
&lt;/h3&gt;

&lt;p&gt;Some Common test operators&lt;/p&gt;

&lt;p&gt;| Operator | Description | Usage |&lt;br&gt;
| -d | Checks if file is a directory | -d $file |&lt;br&gt;
| -f | Checks if file is an ordinary file | -f $file |&lt;br&gt;
| -p | Checks if file is a named pipe | -p $file |&lt;br&gt;
| -r | Checks if file is readable | -r $file |&lt;br&gt;
| -w | Checks if file is writable | -w $file |&lt;br&gt;
| -x | Checks if file is executable | -x $file |&lt;br&gt;
| -s | Checks if file has a size greater than zero (0) | -s $file |&lt;br&gt;
| -e | Checks if file exists | -e $file |&lt;/p&gt;
&lt;h2&gt;
  
  
  Shell loops
&lt;/h2&gt;

&lt;p&gt;Loops are used to execute a set of commands repeatedly.&lt;/p&gt;
&lt;h3&gt;
  
  
  For Loop
&lt;/h3&gt;

&lt;p&gt;This type of loop repeats a set of commands for every item in a list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for var in &amp;lt;list&amp;gt;
do
    &amp;lt;command&amp;gt;
done

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

#This will print numbers 1 to 5
for value in {1..5}
do
   echo $value
done

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  While Loop
&lt;/h3&gt;

&lt;p&gt;This loop executes a set of commands while a given condition is true, so the loop will stop when the condition becomes false.&lt;/p&gt;

&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while [&amp;lt;condition&amp;gt;]
do
    &amp;lt;command&amp;gt;
done

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Will print numbers 1 to 5
count=1
while [$count -le 5]
do
echo $count
((count++)) #Will increment count by 1 after every loop
done

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Until Loop
&lt;/h3&gt;

&lt;p&gt;This loop will execute a set of commands until a given condition becomes true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;until [&amp;lt;condition&amp;gt;]
do
    &amp;lt;command&amp;gt;
done

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Will print numbers 1 to 5
count=1
until [$count -gt 5] #Loop will stop one count is greater than 5
do
echo $count
((count++)) #Will increment count by 1 after every loop
done

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Shell functions
&lt;/h2&gt;

&lt;p&gt;A function is a reusable block of a set of commands. Functions help you to not repeat yourself as you can write a function to perform a specific task and then use it many times whenever and wherever you need it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Function Syntax
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Without the function keyword
function_name () {
       &amp;lt;commands&amp;gt;
}

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

&lt;/div&gt;



&lt;p&gt;Or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#With the function keyword
function function_name {
       &amp;lt;commands&amp;gt;
}

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!bin/bash
#A function that prints out the first argument supplied to it
 function printArg () {
          echo The first argument is $1
}
#Function call with an argument
printArg "Hello World"

#The output of the function above will be "The first argument is Hello World"

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

&lt;/div&gt;



&lt;p&gt;Both methods of declaring functions are valid and will behave the same so whichever you decide to use is based on your preference. If you are familiar with other programming languages that also have brackets in their function declaration, you would think the brackets are for arguments but in bash, it is not so. The brackets are merely for decoration and nothing should be placed in them. From the code above, you can see that arguments are provided directly after the function name when you call the function.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Note - you can't call a function before you have declared it.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conditional Statements for Shell Scripts
&lt;/h2&gt;

&lt;p&gt;Conditional statements allow you to make decisions based on a condition or test within your shell script.&lt;/p&gt;
&lt;h3&gt;
  
  
  If Statements
&lt;/h3&gt;

&lt;p&gt;This will perform a given set of instructions or commands if the test or condition provided is true, the set of instructions won't be carried out otherwise.&lt;/p&gt;
&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if [&amp;lt;condition/test&amp;gt;]
then
      &amp;lt;command&amp;gt;
fi

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

&lt;/div&gt;

&lt;h3&gt;
  
  
  If Else Statements
&lt;/h3&gt;

&lt;p&gt;This works just like the basic if statements explained above but also provides room for a condition to be performed if the condition is not true. If the condition is not true, the command or set of commands () between &lt;code&gt;else&lt;/code&gt; and &lt;code&gt;fi&lt;/code&gt; will be executed.&lt;/p&gt;
&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if [&amp;lt;condition/test&amp;gt;]
then
      &amp;lt;command1&amp;gt;
else
      &amp;lt;command2&amp;gt;
fi

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

&lt;/div&gt;


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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!bin/bash
#This script will take 2 numbers as command-line arguments. It will print to the screen the larger of the two numbers.

if [$1 -gt $2]

then
   echo $1
else
   echo $2
fi

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sThncVYc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614612429475/DBtHLanJ0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sThncVYc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614612429475/DBtHLanJ0.png" alt="image8.png" width="880" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  If Elif Else
&lt;/h3&gt;

&lt;p&gt;This is used for multiple conditions with different outcomes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if [&amp;lt;condition1&amp;gt;]
then
      &amp;lt;command1&amp;gt;
elif [&amp;lt;condition2&amp;gt;]
then
      &amp;lt;command2&amp;gt;
elif [&amp;lt;condition3&amp;gt;]
then
      &amp;lt;command3&amp;gt;
else
      &amp;lt;command&amp;gt;
fi

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; A script that will print a message based upon which day of the week it is.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
#script to print a message based upon which day of the week it is.

day_of_the_week=$(date +%u)

if [$day_of_the_week -eq 1]
then
   echo Today is Monday, aargh!
elif [$day_of_the_week -eq 2]
then
   echo Today is Tuesday
elif [$day_of_the_week -eq 3]
then
   echo Today is Wednesday
elif [$day_of_the_week -eq 4]
then
   echo Today is Thursday
elif [$day_of_the_week -eq 5]
then
   echo Today is Friday, TGIF!
elif [$day_of_the_week -eq 6]
then
   echo Today is Saturday
elif [$day_of_the_week -eq 7]
then
   echo Today is Sunday
else
   echo Something is wrong
fi

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D9evbhtq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614616216269/5cWPtiip8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D9evbhtq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614616216269/5cWPtiip8.png" alt="image1.png" width="880" height="200"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Note - you can change your system time to see the different outputs else it will only display the output for your present day.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
You can have as many &lt;code&gt;elif&lt;/code&gt; branches as you want. It is valid to have an if statement inside another one, that is nesting if statements. Note - You have to include spaces in the square bracket that contains the condition as seen in the examples else an error will be return.&lt;/p&gt;
&lt;h3&gt;
  
  
  Case Statements
&lt;/h3&gt;

&lt;p&gt;This should be used in cases that might lead to a long string of if and elif statements, case statements present it in a much neater way.&lt;/p&gt;
&lt;h4&gt;
  
  
  Syntax
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Case &amp;lt;variable&amp;gt; in
    &amp;lt;pattern1&amp;gt;)
          &amp;lt;command&amp;gt;
          ;;
    &amp;lt;pattern2&amp;gt;)
          &amp;lt;command2&amp;gt;
          ;;
esac

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

&lt;/div&gt;


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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

echo Which color do you prefer? Blue, Green or Yellow? #This will be printed first when you run the script.
read color #Prompt to accept input

case $color in #Compare using the value entered for color at the prompt ********
    Blue)
        echo Feeling blue today?
        ;;
    Green)
        echo The land is green!
        ;;
    Yellow)
        echo It is going to be a sunny day!
        ;;
     *)
        echo Try Again
        ;;
esac #Indicates the end of the case statement

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cr6H5D7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614640313141/ooUQ5AShF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cr6H5D7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1614640313141/ooUQ5AShF.png" alt="case.png" width="880" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Bash/Shell Scripting is vast and this article is just to help understand the basics to get started. With your knowledge of Linux commands, you can do really useful things with bash scripting and automate repetitive tasks.&lt;br&gt;&lt;br&gt;
Thank you for reading, I hope you find this guide useful 🙂.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://linuxcommand.org/lc3_writing_shell_scripts.php"&gt;http://linuxcommand.org/lc3_writing_shell_scripts.php&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ryanstutorials.net/bash-scripting-tutorial"&gt;https://ryanstutorials.net/bash-scripting-tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pcwdld.com/linux-commands-cheat-sheet"&gt;https://www.pcwdld.com/linux-commands-cheat-sheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Understanding Var, Let and Const in JavaScript</title>
      <dc:creator>Goodness Chris-Ugari</dc:creator>
      <pubDate>Fri, 28 Feb 2020 13:53:23 +0000</pubDate>
      <link>https://dev.to/goodiec/understanding-var-let-and-const-in-javascript-49bk</link>
      <guid>https://dev.to/goodiec/understanding-var-let-and-const-in-javascript-49bk</guid>
      <description>&lt;p&gt;There is more than one way to declare a variable in JavaScript, it uses the &lt;strong&gt;var&lt;/strong&gt;, &lt;strong&gt;let&lt;/strong&gt; and &lt;strong&gt;const&lt;/strong&gt; keywords for variable declarations and they all behave differently. I will try to explain them and their different behaviors but before I do that, I would like to explain some concepts that you will come across in trying to understand the various variable declarations, these are &lt;strong&gt;Scope&lt;/strong&gt; and &lt;strong&gt;Hoisting&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt; - The scope of a variable or function is the part of the code where the variable is visible or accessible. So it simply means variable access, that is,  what variables do I have access to where the code is running. When a variable is not declared within a function, it is said to have a global scope, is assigned to the global object and can be accessed or referenced from anywhere. A variable declared within a function is said to have a local scope and can only be accessed inside the function.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Hoisting&lt;/strong&gt; - This suggests that before code execution all variable or function declarations are moved to the top of the code. Technically, they are put into memory but stay exactly where you typed them in your code. Hoisting allows you to use functions before you declare them, so you can doing something like this would be valid:&lt;/p&gt;

&lt;p&gt;someFunction()&lt;br&gt;
function someFunction(){&lt;br&gt;
   //do something&lt;br&gt;
}&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;So now we can move on to the different methods of declaring variables in JavaScript&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Var&lt;/strong&gt; - var is traditionally function scoped, variable declared with var outside any function has a global scope and is visible everywhere. A variable declared with var inside a function is assigned to that function, it is local and is visible only inside the function just like a function argument or parameter.&lt;br&gt;
If a variable is declared in a function with the same name as a global variable, it takes precedence over the global variable, shadowing it. &lt;br&gt;
Var is function scoped not block-scoped so if you don't create a new function, you don't get a new scope, a block (identified by a pair of curly braces ({})) does not define a new scope, so things like if statements don't actually create a new scope.&lt;br&gt;
In JS all variables defined with the var keyword have an initial value of "undefined", this is due to hoisting which puts them in the memory with an initial value of undefined.&lt;br&gt;
Var is a less than ideal way to create a variable as you can redeclare a variable that has already been created and not get an error.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Let&lt;/strong&gt; - This is a new way of declaring variables in JavaScript. It is the block-scoped version of Var. Block means anything surrounded by curly braces {}. So with let, things like if statements and for loops create new scopes. Defining a variable outside a function using let unlike var doesn't create a global variable. A variable declared using let can be reassigned just like with var but it can't be redeclared, trying to redeclare a variable created using let will return an error. like var, variables declared using let are also hoisted but uninitialized variables don't have an initial value of "undefined". With let, when you reference uninitialized variable, you get a ReferenceError.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Const&lt;/strong&gt; - This keyword is used to declare constants i.e. variables that are not going to change. Variables created using const can't be changed or reassigned to a different value. It doesn't provide immutability, it just makes sure that the reference can't be changed; that is to say, that with constant you can change the properties of the constant if it an object, you just can't reassign the variable. Const is block-scoped like let. If you have anything that isn't going to change, it should be a constant as it is a lot safer declaring it like that so that nobody assigns something else to the variable name.&lt;br&gt;
Const variables are also hoisted but not assigned as with let.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
Var is function scoped and an uninitialized var variable is assigned the value of undefined. Let and const were introduced in ES6, they are both block-scoped and can't be redeclared, trying to access an uninitialized const or let variable will return a ReferenceError. Variables declared with let can be reassigned but with const, they can't be.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
