<?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: Sophia Enakpoya</title>
    <description>The latest articles on DEV Community by Sophia Enakpoya (@sophie).</description>
    <link>https://dev.to/sophie</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%2F260737%2F72039896-6483-4769-8234-d9c696bffe1f.jpeg</url>
      <title>DEV Community: Sophia Enakpoya</title>
      <link>https://dev.to/sophie</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sophie"/>
    <language>en</language>
    <item>
      <title>Understanding Scope in JavaScript</title>
      <dc:creator>Sophia Enakpoya</dc:creator>
      <pubDate>Fri, 22 Jul 2022 11:41:00 +0000</pubDate>
      <link>https://dev.to/sophie/understanding-scope-in-javascript-2pml</link>
      <guid>https://dev.to/sophie/understanding-scope-in-javascript-2pml</guid>
      <description>&lt;p&gt;This article assumes you have a good understanding of variables and the different ways of declaring variables in JavaScript as those concepts won't be treated.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Scope?
&lt;/h2&gt;

&lt;p&gt;Scope is what determines the accessibility(visibility) of variables. Scoping controls where a variable is accessible and the time the variable definition is maintained. There are three types of scope in JavaScript: Global Scope, Local Scope and Block Scope.&lt;/p&gt;

&lt;h3&gt;
  
  
  Global Scope
&lt;/h3&gt;

&lt;p&gt;Global Scope is the default scope for all codes running in script mode. Variables declared outside of any function or block of code become global variables and are accessible from anywhere in the code. There is one copy of a global variable in the entire program.&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;// global scope&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sophia&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    &lt;span class="c1"&gt;//Sophia&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getName&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;//name is accessible here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 

&lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;           &lt;span class="c1"&gt;//Sophia&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Variables defined outside of any function become global variables and can also be modified from any function. Take our earlier name variable:&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;// global scope&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sophia&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    &lt;span class="c1"&gt;//Sophia&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getName&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;//name is accessible here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;changeName&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jane&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;//name is accessible here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 


&lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;           &lt;span class="c1"&gt;//Sophia&lt;/span&gt;
&lt;span class="nx"&gt;changeName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;        &lt;span class="c1"&gt;//Jane&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changing the value of a global variable in any function will be reflected through out the program. We can already see why it is not good practice to declare global variables unintentionally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Scope
&lt;/h3&gt;

&lt;p&gt;Local scope can also be referred to as function scope. A function creates a scope and variables declared within that function becomes local to that function and cannot be accessed from outside that function. Consider the following 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="c1"&gt;//Local Scope&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sophia&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;//name can only used in getName&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;     &lt;span class="c1"&gt;//Sophia&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;//Causes error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Local variables are only accessible inside their functions, which means variables with same name can be used in different functions and their values won't be overwritten. Local variables are created when a function starts, and deleted once the function is completed.&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;//Local Scope&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sophia&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getOtherName&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Xavier&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;          &lt;span class="c1"&gt;//Sophia&lt;/span&gt;
&lt;span class="nx"&gt;getOtherName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;     &lt;span class="c1"&gt;//Xavier&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now take a look at this code 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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createCounter&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;incrementCounter&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="nx"&gt;count&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;p&gt;What is the scope of the &lt;code&gt;count&lt;/code&gt; variable above and would the &lt;code&gt;incrementCounter&lt;/code&gt; function work?&lt;br&gt;
Before you answer, note that JavaScript does not require variables to be declared before they are used and undeclared variables are put in the global scope. Let me know your answer in the comment section.&lt;/p&gt;
&lt;h3&gt;
  
  
  Block Scope
&lt;/h3&gt;

&lt;p&gt;Prior to ES6(2015), JavaScript only had Local(Function) Scope and Global Scope. With the introduction of &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;, the Block Scope was provided. Block Scope is simply the area within &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;switch&lt;/code&gt; statements, and &lt;code&gt;loops&lt;/code&gt;. A block is generally contained within curly brackets &lt;code&gt;{ }&lt;/code&gt;. &lt;br&gt;
Variables declared inside a &lt;code&gt;{ }&lt;/code&gt; cannot be accessed from outside that block.&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;//Block Scope&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&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;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;count&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;span class="c1"&gt;//count is accessible here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;//count is not accessible here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The count variable comes into existence when the loop block is entered and destroyed once the loop is exited. Note that blocks only scope variables declared with &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In summary, scoping is what controls where variables are accessible. Global variables always exists and are accessible throughout the program. Block and Function variables are only accessible in the block/function they are declared in. &lt;br&gt;
&lt;strong&gt;Note however that there is the concept of Closures which allow variables to be accessed outside of the local scope.&lt;/strong&gt; Closures will be discussed in more detail in my next article. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A quick look at SSR and CSR</title>
      <dc:creator>Sophia Enakpoya</dc:creator>
      <pubDate>Wed, 15 Jun 2022 15:12:30 +0000</pubDate>
      <link>https://dev.to/sophie/a-quick-look-at-ssr-and-csr-11e6</link>
      <guid>https://dev.to/sophie/a-quick-look-at-ssr-and-csr-11e6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello devs!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are several methods of rendering pages on the browser. A common challenge is when to choose which method for our websites and web applications. Today we're going to take a brief look at two of such methods - SSR and CSR.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So what's the deal with these abbreviations?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SSR and CSR simply refers to the different methods used by software developers to transfer html content to the client.&lt;br&gt;
&lt;strong&gt;SSR&lt;/strong&gt; is short for &lt;strong&gt;Server-Side Rendering&lt;/strong&gt; while &lt;strong&gt;CSR&lt;/strong&gt; is for &lt;strong&gt;Client-Side Rendering&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;*Note: There are other methods of rendering pages on the browser e.g. SSG, ISR, but our focus today is only on SSR and CSR. &lt;/p&gt;

&lt;h3&gt;
  
  
  Server-Side Rendering (SSR)
&lt;/h3&gt;

&lt;p&gt;This is the most common method of rendering HTML onto a screen.&lt;br&gt;
A user requests access to a webpage. Server sends ready to go HTML files to the client. Browser then renders the page but it's not interactive. Browser downloads and execute the JavaScript. Page is now interactive. This is all done within a few milliseconds. The heavy lifting is done on the server. This means that if there are any API calls to be made, it is all done on the server-side, then sent along with the markup to the client.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iVT8tVM_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cq54fjqasx894cdh3ei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iVT8tVM_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cq54fjqasx894cdh3ei.png" alt="SSR" width="880" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Pros
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Better SEO. Search engines can crawl the site effectively.&lt;/li&gt;
&lt;li&gt;Initial page load is faster&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cons
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Frequent server requests&lt;/li&gt;
&lt;li&gt;Full page reloads&lt;/li&gt;
&lt;li&gt;Slow page rendering for subsequent pages&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Client-Side Rendering (CSR)
&lt;/h3&gt;

&lt;p&gt;This method simply means the pages are directly rendered in the browser. In this method, the heavy lifting is done on the client rather than the server. A user requests access to our webpage, server sends a response to our browser, browser downloads the JavaScript file and executes the content. Page is now visible and user can navigate and interact with the web page.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TXZDQUdW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9i5qa84b2p2syhrqzmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TXZDQUdW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9i5qa84b2p2syhrqzmg.png" alt="CSR" width="880" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Pros
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Fast website rendering after the initial load&lt;/li&gt;
&lt;li&gt;Great for web applications&lt;/li&gt;
&lt;li&gt;Rich interactions&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cons
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Requires external libraries in some cases&lt;/li&gt;
&lt;li&gt;Initial page load is slow&lt;/li&gt;
&lt;li&gt;Poor SEO if not implemented correctly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing the right rendering method will depend on your use case and what works for you. Web applications and websites are two different formats of web content. Web apps require more interaction since users need to perform tasks. A website, on the other hand, is simply a page that offers or provides info about a business, hence, not a lot of user interactions.&lt;/p&gt;

&lt;p&gt;Thanks for reading. I hope this helps you understand these concepts a little better. For more deep dive, comparisons and visual representation of the different rendering methods, check out the links below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/pahanperera/visual-explanation-and-comparison-of-csr-ssr-ssg-and-isr-34ea"&gt;Visual Explanation and Comparison of CSR, SSR, SSG and ISR&lt;/a&gt;&lt;br&gt;
&lt;a href="https://web.dev/rendering-on-the-web/"&gt;Rendering on the Web&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=Y2spCNZDt84"&gt;Tech Talk&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/thetombomb/rendering-options-on-the-web-server-client-static-20e"&gt;Rendering Options on the Web&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading 👋&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to remove a sensitive file from your commit history on GitHub</title>
      <dc:creator>Sophia Enakpoya</dc:creator>
      <pubDate>Thu, 28 Jan 2021 10:19:28 +0000</pubDate>
      <link>https://dev.to/sophie/how-to-delete-a-secret-file-from-github-ing</link>
      <guid>https://dev.to/sophie/how-to-delete-a-secret-file-from-github-ing</guid>
      <description>&lt;p&gt;Yes! this has happened to most of us at least once in our career, especially when we are just starting. We accidentally commit sensitive data to GitHub. We forget to gitignore our config file containing database passwords or API keys or jwt secrets. And we immediately start to panic. &lt;/p&gt;

&lt;p&gt;This happened to me a couple of days ago. I  forgot to ignore my default JSON file that contained my database connection password and jwt secret. I had just gotten a feature to finally work and in the excitement, I immediately committed and pushed to GitHub. I only realized my error when I got a notification from GitGuardian that my latest commit contained secret keys. &lt;/p&gt;

&lt;p&gt;If you find yourself in the same position, the first thing you do is &lt;strong&gt;change the visibility of the repo&lt;/strong&gt;. So, if it's a public repo, make it private. This way, you're sure no one else sees the file while you're working on deleting it.&lt;/p&gt;

&lt;p&gt;Next thing, if you aren't already in the project folder, cd into it on git bash or whatever terminal you are using. Let's assume my project folder is My-Project and I have a file named secretFile.json I want to delete.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd My-Project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then run the following command. You have to include the path to the file and not just the file name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch config/secretFile.json" \
  --prune-empty --tag-name-filter cat -- --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;replacing config/secretFile.json with the path to the file you want to be removed. In my case, secretFile.json is inside of a folder named config. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The command above deletes the file from your local repository too, so ensure you have copied the content to a notepad or whatever you use before running the command.&lt;/p&gt;

&lt;p&gt;Then create and add your file to .gitignore so you don't accidentally push it to GitHub again. You can do that with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "name-of-your-file" &amp;gt;&amp;gt; .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m 'add file to .gitignore'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you are satisfied with your changes, you can then push them to GitHub&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin --force --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! Your repo history is clean without any trace of your sensitive file.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>5 tips that will help you grow quickly as a new developer</title>
      <dc:creator>Sophia Enakpoya</dc:creator>
      <pubDate>Sun, 01 Nov 2020 08:29:11 +0000</pubDate>
      <link>https://dev.to/sophie/5-tips-that-will-help-you-grow-quickly-as-a-new-developer-1k47</link>
      <guid>https://dev.to/sophie/5-tips-that-will-help-you-grow-quickly-as-a-new-developer-1k47</guid>
      <description>&lt;p&gt;Hi there! My name is Sophia and this is my very first post. When I first started learning to code, there were lots of mistakes I made that probably set me back for a while and I thought I should write about them so that other new developers can learn from it. &lt;/p&gt;

&lt;p&gt;So here are five things I would do differently if I had to go back and do it all over again.&lt;/p&gt;

&lt;p&gt;PS. This is my own experience and what I would have liked to know at the time I was just starting out so feel free to take everything I've written with a grain of salt.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Join a community
&lt;/h2&gt;

&lt;p&gt;The mistake some of us make is trying to learn in isolation. When I initially started learning, I spent almost a year going in circles. I didn't know anyone else who was into what I was trying to do. Real-life and even online. So I kept jumping from tutorial to tutorial, not really mastering anything. At some point, I completely lost interest and went almost 3 months not coding. The turning point for me was when I found a discord channel from FCC(freecodecamp). I met others who were at the same place I was and made connections. They helped keep me going and motivated when I felt helpless because, let's admit it, coding is hard and you're going to face difficulties as you go. The importance of a community can never be over-emphasized. It could be physical or virtual. For my circle and I, we went the virtual way and it has been really great. As early as you can, find a community that interests you and meet others who are on the same journey with you and also others who have gone through. A good place to find these communities is on Twitter. Get active. Interact with other developers. These connections can also help when you're ready for the job hunt.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Ask questions
&lt;/h2&gt;

&lt;p&gt;When we are new at something, it's easy to always try figuring things on your own. But if you have been in the tech space for any amount of time, you would have probably heard someone say there are no stupid questions. It will help if you develop the habit of asking questions early on. There's no use to stay stuck on a problem for longer than necessary when there are people who can help you out. Also, build up your googling skills. Asking questions can be on google to friends or other community members. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Manage your expectations/ Have realistic goals
&lt;/h2&gt;

&lt;p&gt;I've often heard people say everything is possible with tech. They say if you want to change your life, learn to code. While all of that is very enticing because, obviously, who doesn't want a better life? But what they don't tell you is how important it is to manage your expectations. I've read countless articles where the authors talk about how they learned to code and got six-figure salaries within 6 months. Exciting right? Now you wanna learn and get the same results in six months or possibly less. What you should know is, that isn't the case for a good percentage of devs out there. Some took 2 years or more to learn and get job-ready and then spent even more time before getting full-time jobs. So I say again, you must manage your expectations. This is because it's easy to lose interest and motivation quickly when you set out with a four-month goal and it's six months and you aren't where you planned to be. Now, don't get me wrong. I'm not saying you can't learn to code and be successful in a very short time or that you shouldn't push yourself as fast and hard as you can. No. I'm saying that things don't always go the way we plan and there's always difficulties along the way. Just learn to pick yourself up and keep going no matter what. And that would be my last point: determination.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Have a mentor
&lt;/h2&gt;

&lt;p&gt;As good as joining a community is, having a mentor is also very important. A mentor doesn't necessarily have to be someone very advanced. Just someone who can assist when you need it. I got my first mentor almost a year after I started learning web dev. It was in the discord community and I can say he really helped me through some rough patches. Those times I wanted to give up, he was there encouraging me to just keep going. He knew exactly what I was feeling because he had gone through the same journey just a few years earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Be determined
&lt;/h2&gt;

&lt;p&gt;According to Wikipedia: 'Determination is a positive emotional feeling that involves persevering towards a difficult goal despite obstacles. Determination occurs before goal attainment and serves to motivate behavior that will help achieve one's goal.' Simply put, a determination is 'firmness of purpose'. Determination is really important in your journey. If you're not determined to see your goal through, you'll easily get discouraged by the sheer volume of what you have to learn. And it is really tempting to just give up when you first start learning concepts and you cant understand. Be determined! Keep going! It will eventually pay off. &lt;/p&gt;

&lt;p&gt;Thanks a lot for reading. If you got this far and you liked my writing, feel free to reach out to me or say hi on Twitter &lt;a href="https://twitter.com/sophia_enax"&gt;@sophia_enax&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>career</category>
    </item>
  </channel>
</rss>
