<?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: Lateef Adetona</title>
    <description>The latest articles on DEV Community by Lateef Adetona (@heyylateef).</description>
    <link>https://dev.to/heyylateef</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%2F791896%2F0b645104-2d9c-4ed4-aaea-3b3d51ff983a.jpeg</url>
      <title>DEV Community: Lateef Adetona</title>
      <link>https://dev.to/heyylateef</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/heyylateef"/>
    <language>en</language>
    <item>
      <title>How to Display a Loading Spinner while DOM is rendering in ReactJS</title>
      <dc:creator>Lateef Adetona</dc:creator>
      <pubDate>Tue, 02 Aug 2022 09:35:48 +0000</pubDate>
      <link>https://dev.to/heyylateef/how-to-display-a-loading-spinner-while-dom-is-rendering-in-reactjs-nlg</link>
      <guid>https://dev.to/heyylateef/how-to-display-a-loading-spinner-while-dom-is-rendering-in-reactjs-nlg</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;﻿Design is important step when creating any product. User experience is key when capturing and retaining the attention of users. Many users don't understand how large our applications truly are and how long things such as HTTP requests or build times could take. When they visit our website but they are introduced to a blank screen, they think the website could be broken and then travel to another website. &lt;/p&gt;

&lt;p&gt;In this tutorial, we'll show you to polish your website's user experience by simply adding a big loading spinner when a user visits your site, to indicate that the other components of the website are still loading. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Setup your project
&lt;/h2&gt;

&lt;p&gt;﻿We have to setup our React project. In this tutorial, we're going to use create-react-app. In your terminal/CMD, type the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx create-react-app loading-spinner&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Edit index.html
&lt;/h2&gt;

&lt;p&gt;﻿First step to open index.html. We're going to add div with the "loader-container" class with a child div with the "loader" class. This will be the entry point for our loading spinner within our HTML. Remember, in ReactJS, your project is rendered within the index.html file, specifically within the root div. Adding our loading spinner class directly in the index.html means we can display the class when we start up our React app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Loading Spinner Div --&amp;gt;
    &amp;lt;div class="loader-container"&amp;gt;
      &amp;lt;div class="loader"&amp;gt;&amp;lt;/div&amp;gt;
   &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we've set the entry point within the HTML, lets write some CSS to design a loading spinner! In the same index.html, within the header tag, lets add some CSS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;head&amp;gt;
    &amp;lt;!-- Loading Spinner Styling --&amp;gt;
    &amp;lt;style&amp;gt;
      .loader {
        border: 16px solid #f3f3f3;
        border-top: 16px solid #3498db;
        border-radius: 50%;
        width: 130px;
        height: 130px;
        animation: spin 2s linear infinite;
      }

      @keyframes spin {
        0%  { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      &amp;lt;/style&amp;gt;

&amp;lt;/head&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is how our full index.html should be at this point. Copy and paste the following in your index.html file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- .../public/index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;link rel="icon" href="%PUBLIC_URL%/favicon.ico" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1" /&amp;gt;
    &amp;lt;meta name="theme-color" content="#000000" /&amp;gt;
    &amp;lt;meta
      name="description"
      content="Web site created using create-react-app"
    /&amp;gt;
    &amp;lt;link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /&amp;gt;
    &amp;lt;!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    --&amp;gt;
    &amp;lt;link rel="manifest" href="%PUBLIC_URL%/manifest.json" /&amp;gt;
    &amp;lt;!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    --&amp;gt;
    &amp;lt;title&amp;gt;React App&amp;lt;/title&amp;gt;

    &amp;lt;!-- Loading Spinner Styling --&amp;gt;
    &amp;lt;style&amp;gt;
      .loader {
        border: 16px solid #f3f3f3;
        border-top: 16px solid #3498db;
        border-radius: 50%;
        width: 130px;
        height: 130px;
        animation: spin 2s linear infinite;
      }

      @keyframes spin {
        0%  { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      &amp;lt;/style&amp;gt;

  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;noscript&amp;gt;You need to enable JavaScript to run this app.&amp;lt;/noscript&amp;gt;
    &amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;!-- Loading Spinner Div --&amp;gt;
    &amp;lt;div class="loader-container"&amp;gt;
      &amp;lt;div class="loader"&amp;gt;&amp;lt;/div&amp;gt;
   &amp;lt;/div&amp;gt;
    &amp;lt;!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the &amp;lt;body&amp;gt; tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    --&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Edit App.js
&lt;/h2&gt;

&lt;p&gt;Now, lets turn our attention to App.js. We're going to do 4 things:&lt;/p&gt;

&lt;p&gt;Define a state variable so we can manage the state of our application&lt;br&gt;
Define a function that simulates a request&lt;br&gt;
Use the useEffect() React Hook to run our simulated request&lt;br&gt;
Render our HTML, based on or state variable&lt;br&gt;
First things first, we have to import useState and useEffect at the top of our App.js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//../src/App.js
import React, {useState, useEffect} from 'react';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now define our state variable within App() function. Add the following directly after defining our App() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//../src/App.js

function App() {
  const [isLoading, setLoading] = useState(true);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We utilize React Hooks useState() so we can keep track of the value (or state) of a variable throughout the lifecycle of our application. In this example, we're using useState() to keep track of a boolean type variable. We're going to switch the boolean from being "true" to "false" throughout our application. Moving on to our fake request, add the following directly under where we defined our state variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function someRequest() { //Simulates a request; makes a "promise" that'll run for 2.5 seconds
    return new Promise(resolve =&amp;gt; setTimeout(() =&amp;gt; resolve(), 2500));
  } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We defined a function, someRequest(), that returns a Promise(). A Promise() is a JavaScript method that takes in two arguments; a success callback and failure callback. We use a Promise() to simulate a resolve, knowingly it will fail, and our code will execute the failure callback, which is setting a timeout of 2.5 seconds (or 2500 milliseconds).&lt;/p&gt;

&lt;p&gt;Now we can call the useEffect() React Hook to call our someRequest() function, which will remove our loader spinner div within the index.html and toggle our state variable. Copy and paste the following code after our someRequest() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    someRequest().then(() =&amp;gt; {
      const loaderElement = document.querySelector(".loader-container");
      if (loaderElement) {
        loaderElement.remove();
        setLoading(!isLoading);
      }
    });
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, for our application to display the loading spinner on render, we have to add an except directly before our render() method. Add the following to your App.js right before the render() method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (isLoading) {
    return null;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And thats it go ahead and run your application with the following command in your terminal/CMD:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ npm start&lt;/code&gt;&lt;br&gt;
Now you have a loading spinner that displays as your application (presumedly making some sort of request to a server, as simulated with the use of our someRequest() function) and disappears when our application is finish rendering.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lateeflab.com/display-a-loading-spinner-while-dom-is-rendering-in-reactjs/"&gt;Check out the full article on LateefLab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What is StackBlitz? How to use it in your article</title>
      <dc:creator>Lateef Adetona</dc:creator>
      <pubDate>Mon, 23 May 2022 22:45:00 +0000</pubDate>
      <link>https://dev.to/heyylateef/what-is-stackblitz-how-to-use-it-in-your-article-47pg</link>
      <guid>https://dev.to/heyylateef/what-is-stackblitz-how-to-use-it-in-your-article-47pg</guid>
      <description>&lt;p&gt;&lt;span&gt;&lt;span&gt;Overview&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿A tech blog site (such as this) strives to make learning how to code as simple and seamless as possible. Here at Lateef Lab, we're focused on teaching and practicing web development, both frontend and backend. With the announcement of &lt;a href="https://www.anaconda.com/blog/pyscript-python-in-the-browser"&gt;PyScript&lt;/a&gt;, backend development will be coming to web browsers in the near future. This may allow writers/teachers to explain and guide readers on how to use whatever technologies that are covered within an article, all without leaving their browser tab!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For front-end development within the browser, developers have plenty of options. One of my favorite options is StackBlitz!&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;What is StackBlitz?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://stackblitz.com/"&gt;StackBlitz&lt;/a&gt; is an online developer environment that mimics the look of Visual Studio Code. If you use Visual Studio Code as your primary IDE, you'll feel right at home using StackBlitz. StackBlitz uses "WebContainers" to run Node.js within the browser.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here are some of the features of StackBlitz:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Debugging Node.js with Chrome Dev Tools&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Run your backend (Node.js) within the frontend&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Zero latency editor&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Work offline, no internet connection is required&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;GitHub integration&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Here at &lt;a href="https://lateeflab.com/embed-stackblitz-in-markdown/"&gt;LateefLab&lt;/a&gt;, we like to show React tutorials. To make the learning experience better for readers, we want to show readers how to properly structure their React projects. With displaying StackBlitz within our article, we can cut down on the confusion and ensure a great learning experience. We display our projects within our articles using StackBlitz by embedding the StackBlitz project within the Markdown of our article.&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;&lt;span&gt;What is Markdown?&lt;/span&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Markdown is a markup language for creating formatted text within a text editor. Big publications such as Medium and Dev.to use Markdown to edit their articles (LateefLab is open source, check out the GitHub repo and take a look at how we use Markdown within this site). Luckily, we can take the HTML code view of an article from the editor we use here at LateefLab (thanks to &lt;a href="https://summernote.org/"&gt;Summernote&lt;/a&gt;) and paste it in a Markdown editor and it will keep the same format!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To embed StackBlitz within your own Markdown supported articles, embed the StackBlitz URL in the src attribute within an iframe element, here is an example:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;&amp;lt;iframe height="300" style="width: 100%;" src="https://stackblitz.com/edit/web-platform-3a6hc3?embed=0"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;span&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Check out the full example at &lt;a href="https://lateeflab.com/embed-stackblitz-in-markdown/"&gt;LateefLab&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;


</description>
      <category>react</category>
      <category>stackblitz</category>
      <category>tutorial</category>
      <category>codepen</category>
    </item>
    <item>
      <title>Virtual Environments in Python with Anaconda</title>
      <dc:creator>Lateef Adetona</dc:creator>
      <pubDate>Mon, 23 May 2022 19:12:00 +0000</pubDate>
      <link>https://dev.to/heyylateef/virtual-environments-in-python-with-anaconda-53n1</link>
      <guid>https://dev.to/heyylateef/virtual-environments-in-python-with-anaconda-53n1</guid>
      <description>&lt;p&gt;&lt;span&gt;﻿&lt;/span&gt;&lt;span&gt;﻿&lt;/span&gt;&lt;span&gt;Writing python code on your local system is fun....Until its time to deploy your project and you find yourself scratching your head wondering why your project contains too many dependancies.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In tutorial, we're going to setup Anaconda, a popular data science toolkit that contains a package manager (conda) and integrates with a lot of popular applications that many python developers use.&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;&lt;span&gt;﻿&lt;b&gt;What is Anaconda?&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿Anaconda is a popular, open-source software toolkit that contains many of the tools for the modern day data scientist. Many data scientists consume and analyze data using Python and R programming languages. The purpose of the toolkit is to be the &lt;a href="https://en.wikipedia.org/wiki/Batteries_Included#:~:text=Motto%20of%20the%20Python%20programming,parts%20required%20for%20full%20usability"&gt;"batteries included"&lt;/a&gt; developer environment for data scientists.&lt;/span&gt;&lt;/p&gt;



&lt;p&gt;&lt;span&gt;&lt;br&gt;&lt;/span&gt;&lt;span&gt;﻿&lt;b&gt;Installation&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿On your PC, go to &lt;a href="https://www.anaconda.com/products/individual"&gt;https://www.anaconda.com/products/individual&lt;/a&gt; and download the installer for your system. Go ahead and continue through the installer using the recommended choices.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/media/django-summernote/2021-11-01/9ea4a959-e587-4cce-9d86-743ea1819647.png" class="article-body-image-wrapper"&gt;&lt;img src="/media/django-summernote/2021-11-01/9ea4a959-e587-4cce-9d86-743ea1819647.png"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;span&gt;﻿&lt;/span&gt;&lt;span&gt;﻿&lt;b&gt;Basic&lt;/b&gt; &lt;b&gt;Usage&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿Once installed, if you're on Mac, open terminal. If you're Windows, browse to your programs and open "Anaconda Prompt". You'll see the current environment opened in your new terminal session.&lt;/span&gt;&lt;/p&gt;

&lt;pre&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;(base) MBP:~ lateefa$&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;﻿&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;


&lt;p&gt;&lt;span&gt;﻿Great, our new terminal session is using conda's base environment, lets check out the packages installed in the base environment. In your terminal session, run the following command:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;﻿conda list&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;A lot (almost overwhelming) amount of packages are in the base environment. That is a good thing though! For a lot of python scripting and other projects, you have a lot of the necessary packages needed to get to testing.&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;&lt;b&gt;Preferred Usage&lt;/b&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿Using the base environment is fine for testing, but for most python projects (especially Django) you don't need those extra packages. So lets create another environment using the base package manager, conda! For many Python developers, we may just need to start out with Python (and its standard dependancies) for our new environment. Lets use the conda package manager to create new environment that contains the latest version of Python 3.9 and its standard packages.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In your terminal, run the following command:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;﻿conda create --name mynewpyenv python=3.9&lt;/span&gt;&lt;span&gt;&lt;br&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;The following output will appear, showing all the packages you''ll be installing into the new environment:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;The following NEW packages will be INSTALLED:&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;ca-certificates&lt;/span&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::ca-certificates-2021.10.26-hecd8cb5_2&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;certifi&lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::certifi-2021.10.8-py39hecd8cb5_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;libcxx &lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::libcxx-12.0.0-h2f01273_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;libffi &lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::libffi-3.3-hb1e8313_2&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;ncurses&lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::ncurses-6.3-hca72f7f_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;openssl&lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::openssl-1.1.1l-h9ed2024_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;pip&lt;/span&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::pip-21.2.4-py39hecd8cb5_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;python &lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::python-3.9.7-h88f2d9e_1&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;readline &lt;/span&gt;&lt;span&gt;          &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::readline-8.1-h9ed2024_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;setuptools &lt;/span&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::setuptools-58.0.4-py39hecd8cb5_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;sqlite &lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::sqlite-3.36.0-hce871da_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;tk &lt;/span&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::tk-8.6.11-h7bc2e8c_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;tzdata &lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;pkgs/main/noarch::tzdata-2021e-hda174b7_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;wheel&lt;/span&gt;&lt;span&gt;              &lt;/span&gt;&lt;span&gt;pkgs/main/noarch::wheel-0.37.0-pyhd3eb1b0_1&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;xz &lt;/span&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::xz-5.2.5-h1de35cc_0&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;zlib &lt;/span&gt;&lt;span&gt;              &lt;/span&gt;&lt;span&gt;pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Type "Y" and hit enter to accept and download the packages. Now, lets activate the environment. In the same terminal, enter the following command:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;﻿conda activate mynewpyenv&lt;/span&gt;&lt;span&gt;&lt;br&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;You should see the terminal session activate the new environment like so:&lt;/span&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span&gt;﻿&lt;/span&gt;(mynewpyenv) MBP:~ lateefa$&lt;span&gt; &lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span&gt;﻿Perfect, now we can use pip to install packages such as django, gunicorn, whitenoise, etc. Also, we can use pip to generate the requirements.txt for our project so we can keep up with the dependancies for our python projects! If you need to change environments, simply enter the following command:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;﻿conda deactivate&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;Lastly, I'd recommend that you download the &lt;/span&gt;&lt;a href="https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf"&gt;Conda Cheatsheet&lt;/a&gt;&lt;span&gt;. It holds the most useful conda commands in a 2 page document. I personally find myself referring to it every time I want to start/manage a new environment.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;﻿&lt;b&gt;So...Conda vs. Pipenv vs. Virtualenv&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;﻿&lt;/span&gt;&lt;span&gt;﻿Honestly, I don't have anything against using Pipenv or Virtualenv, I just began using Conda/Anaconda in my early days of a developer and started to use it whenever I setup new PCs for development/deployment as a huge feature of Anaconda is it installs Python on the computer. Sure that only saves me about 5-10 minutes, but why not use the toolkit that installs it for me? &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Overall, use whichever package manager you like, I simply just prefer Anaconda/Conda.&lt;/span&gt;&lt;br&gt;&lt;/p&gt;


</description>
      <category>webdev</category>
      <category>python</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Add Dark Mode to HTML</title>
      <dc:creator>Lateef Adetona</dc:creator>
      <pubDate>Thu, 27 Jan 2022 21:06:00 +0000</pubDate>
      <link>https://dev.to/heyylateef/add-dark-mode-to-html-3i3j</link>
      <guid>https://dev.to/heyylateef/add-dark-mode-to-html-3i3j</guid>
      <description>&lt;h2&gt;
  
  
  Adding Dark Mode to HTML
&lt;/h2&gt;

&lt;p&gt;﻿One of the most useful, often taken for granted, features in mobile and web applications is dark mode. Besides making the user interface look better, it could also provide some &lt;a href="https://www.healthline.com/health/is-dark-mode-better-for-your-eyes"&gt;health benefits&lt;/a&gt; for users. So how can you add a dark mode toggle to your HTML page? It is easy with setting some CSS and JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. CSS
&lt;/h2&gt;

&lt;p&gt;﻿Inside your HTML page, add the following CSS code. This defines a CSS class selector where the CSS is looking for a style class that we defined with a name &lt;strong&gt;dark&lt;/strong&gt;. We're going to change the background to (nearly) pure black and text color to (nearly) pure white.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Dark mode */


.dark{
    background-color: #222;
    color: #e6e6e6;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. JavaScript
&lt;/h2&gt;

&lt;p&gt;﻿While inside of your HTML page, add the following JavaScript code. This snippet will use a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme"&gt;browser API&lt;/a&gt; to detect the whether your local system is using light or dark mode. If your local system is using dark mode, the HTML page will activate a function named &lt;strong&gt;ToggleDarkMode()&lt;/strong&gt;. &lt;strong&gt;ToggleDarkMode()&lt;/strong&gt; ﻿will add the CSS class selector to the HTML document's body element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let isDarkMode= window.matchMedia('(prefers-color-scheme: dark)').matches;
        if(isDarkMode){
            console.log('Currently in dark mode');
            ToggleDarkMode();
        }
        else{
            console.log('Currently not in dark mode');
        }
function ToggleDarkMode() {
        var element = document.body;
        element.classList.toggle("dark");
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Toggle Button
&lt;/h2&gt;

&lt;p&gt;﻿Some users may prefer to see what your website looks like with the opposite setting, so having a toggle would be great. Simply add the following button within your HTML document. The button will use the &lt;strong&gt;onclick﻿﻿&lt;/strong&gt; property to run the &lt;strong&gt;ToggleDarkMode()&lt;/strong&gt; ﻿﻿function, which enables dark mode on your HTML's body element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button onclick="ToggleDarkMode()"&amp;gt;Toggle&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Found any other ways to enable dark mode in HTML? Let us know in the comments below, or contact us in our &lt;a href="https://lateeflab.com/add-dark-mode-in-html/"&gt;blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>darkmode</category>
      <category>beginners</category>
      <category>css</category>
    </item>
  </channel>
</rss>
