Split Testing With Netlify

Split Testing With Netlify:

 Split testing is a feature you aren’t using enough. It’s a great way to test changes with your visitors without minimizing risk. In this tutorial, we’ll learn what split testing is, why you need it, and how to set it up with Netlify.

What is Split Testing?

Split testing is the idea of creating another copy of your website that you can send users to, so you can test new features. Let’s say you have a new design you want to try out. Rather than push that new design to production where everyone can see it, you can test it with a few people.

Here I have redesigned my awesome Vue blog. But I don’t want to dump the new design on everyone. I want to test it out. Here are the options I can do with split testing:

I will keep the main production site with the current (light colored design). Then I can:

  • Only send people I invite to the (private) beta site
  • Have folks “opt in” to the beta site
  • Push a certain amount of (public traffic) to the beta site These are all ways I can test the design without fully committing. If there are major problems with the site, I’ll find them and fix them before everyone sees it.

Enable Split Testing

The first thing I have to do is enable split testing with Netlify. To do that, I must:

  • Create a new branch in git with the new design
  • Enable branch subdomains in Netlify

Once you have created a new branch (name it whatever you like) you can push the new design to that branch. 

If you enable branch subdomains, you’ll see a split testing tab in Netlify:

Option 1: Invite Only (Private Beta)

You enable invite only once you’ve enabled branch subdomains.
Your main traffic goes to your production site:

And you can send testers to the branch subdomain:

Easy stuff. You gather feedback, make changes and when your site is ready to go, you merge the branch.

Option 2: Opt In (Semi Private Beta)

Let’s say you want to make so folks can opt into a beta if they want to, and if not they stay on your production site.
To do that, you create a split test and set 100% of your traffic to production, and 0% to the new beta site:

Now, to route people to the beta site, they will need a cookie set. Netlify uses the nf_ab cookie. If the nf_ab cookie is set to the name of the subdomain, Netlify will route the user to that branch subdomain:

So as long as the cookie is present, they will see the new version of the website (available on the stage subdomain).
For example, in my Vue App, I added a button:

Click here to try our BETA version

Which calls this method:

gobeta: function(){
alert("We are going beta!");
VueCookies.set(‘nf_ab’, "staging", "24h");

This code sets the cookie for anyone wanting to “try out” the beta version of the site.

The “opt in” model is great for your website visitors who are feeling adventurous and want to try out your new site. You leave the production site intact for everyone else.

Option 3: Split Traffic (Public Beta)

So if you’ve created a new design or new features, and you want to “ease into” deploying them, this is the way to go. In the Netlify split testing panel, simply choose a number of people to send to the new site:

In this example, we’re sending 19% of the total public traffic to the new website. This is random, and it could be anyone. Netlify will send a percentage of your visitors to your new site and the rest to your old or “production” site. No need to worry about visitors getting a new site one day and the old one the next. Netlify will use the nf_ab cookie again to route users to the original site they visited.

This is an excellent way to push out some fresh changes, look for feedback, and react. You can even set up a Blue-Green Deployment with this.

Try Out Split Testing For Yourself!

Split testing is an excellent way to test out new features without rolling the dice on a full deployment. Sometimes you want to test a new design, a new feature, or do some A/B testing for advertising. These are all possible with Netlify’s split testing feature. The best part is, it’s easy to set up. You create a new branch, point a subdomain to it, and start tinkering.

from Tumblr https://generouspiratequeen.tumblr.com/post/644361866688249856

Understand Virtual environments in Python

Understand Virtual environments in Python:

Why virtual environments?🤔

Virtual environments are a crucial part on making Python projects, because they allow you to have separated packages for every project you are working on.

It allows us to code with different versions of our needed packages on every project we are working on, and maintaining the packages of our local machine intact.😀

An example could be managing different projects of Django, with different versions like 2.x or the newer 3.x. This could be just because of preferences, or for a business requirement (Since companies usually use older versions of packages).

The cherry on the cake is that Virtual environments allow developers to share the needed packages for the project they are working on, with a simple file normally called requirements.txt and a short command on the terminal.🚀

So with this brief introduction, let’s get into Virtual environments.🤓


Different Virtual environments 😕

There are many virtual environment tools for Python, but I’ll talk about the main two.

Take into account that these two are really similar so you can easily use one or another.


The virtualenv package is a full powered tool that allow you to create and manage virtual environments in Python.

It is a external package and you can install it with:

pip install virtualenv

Python -m venv

Since Python 3.3, an abstracted version of virtualenv is included as a built in package, and therefore it doesn’t require any installation.

Differences between virtualenv and built in venv

Virtualenv is a third party package for managing virtual environments, and it requires installation, while venv is a built in virtual environment package which is just a subset of virtualenv, and doesn’t require installation.

One of the other main differences are that virtualenv supports Python 2.x and Python 3.x, while the built-in method is just available since Python 3.3.

You can find an extensive differentiation here.

Hands on 👋

Now let’s use these tools to build what we love, software. 🖥️

Open your terminal, and type the following commands:

To open a terminal in VS code

Click on the top bar Terminal, and click again in New Terminal.

  • Virtualenv
virtualenv .venv
  • venv
python3 -m .venv

Where the name .venv, could be any name you want to give to your virtual environment. 💡

Note: Remember that no matter what of these two tools you use the following steps will be always the same, the only thing that changes is the creation of the venv.

Venv structure

The structure of a virtual environment is the following

├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── Activate.ps1
│   ├── easy_install
│   ├── easy_install-3.8
│   ├── pip
│   ├── pip3
│   ├── pip3.8
│   ├── python -> /usr/bin/python
│   └── python3 -> python
├── include
├── lib
│   └── python3.8
│       └── site-packages
│           A lot of packages ...
├── lib64 -> lib
└── pyvenv.cfg

131 directories, 1056 files

Where did all this stuff come! 🤯. Well this looks scary but don’t worry.

The bin folder contains all the Python binaries and the activation scripts, we will see later how to activate it.

The lib folders contains all of the modules by itself, for example if you are looking for a function definition of a library, probably your editor will redirect you to the lib folder, where all the modules are located.

# looking for the "UserCreationForm" class on Django 

Activating and deactivating virtual environments

Before we continue I’d like to show you another crucial command while working with virtual environments.

pip freeze

pip freeze will print in the console all the packages available to the Python interpreter you are using.

If you do it in your local machine you will get something like this.

╰─λ pip freeze                                                                                  alembic==1.4.3
etc ...

Those are all the packages that your Python interpreter has installed (and it’s versions). A pretty huge collection it isn’t ? 😁.

Now let’s activate the virtual environment, called .venv

# .venv is the name of the virtual environment
# Activation for a bash shell in Linux or Mac
source .venv/bin/activate

Activating a venv in other shells

Depending of the shell you use, probably you will use a different command, so take a look at the following table.

In my case since I use fish as my primary shell, I always use activate.fish.

You will notice a little change in your terminal, and it’s because you get a little graphic of what environment are you using.

In my case:

After that little parenthesis, run pip freeze again, what do you get?

Exactly, Nothing

You don’t get output, just because the virtual env, has a totally isolated Python interpreter instance, with it’s own libraries installed. 😮

Deactivating Virtual environments

Deactivate an environment is really easy, just run


You will notice that you don’t have the name of the venv in your terminal, and if you run pip freeze, you will get all your installed packages.

Installing packages

Before installing any package be sure to have your venv activated!

Depending in which project you are working on, you will want to install the latest and greatest versions, or a specific version.

To install the latest packages with pip just run:

pip install {package}

For example

# Installing it
pip install requests

# pip freeze

Installing a specific version

To install a specific version of a package, run pip install {package name}=={version number}

# Installing Django 2.2

pip install django==2.2

# pip freeze


Remember that if you want to check the Django version, just invoke python and run the following code.

╰(.venv)─λ python                                                                             
Python 3.8.6 (default, Sep 30 2020, 04:00:38) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())

Installing packages from a text file

To install the packages from a text file just run.

pip install -r {name of the file}.txt
# Usually the file is named requirements.txt

This is extremely useful when you are collaborating in a Python project, and with just a command you get all the necessary stuff to start coding.😄

To write all your packages in a file run this command.

pip freeze > requirements.txt

This will generate a file named requirements.txt, which content will be the output of pip freeze.

This way is how most specialized servers install the needed packages, to deploy python apps. You give them a file with the requirements and not the virtualenv itself.

Conclusion 😃

Now that you know how to use Virtual environments, you can:

  • Separate the requirements for each of your projects
  • Install different versions of packages
  • Collaborate easily since with just a command or two, you can set up your environment
  • Don’t mess around the libraries of your machine 😅

Commands shortcut 👍:

# Install virtualenv, and create one
pip install virtualenv
virtualenv {venv name}

# Built in method (Python 3.3 +)
python -m venv {venv name}

# Activating
source {venv name}/bin/activate

# Deactivating

# Install from file
pip install -r {file}.txt

# Write a file
pip freeze > requirements.txt

from Tumblr https://generouspiratequeen.tumblr.com/post/644361866222665728

You Need to Try These 10 NPM Packages as a React Developer

You Need to Try These 10 NPM Packages as a React Developer:

 As web developers, we tend to make use of several NPM packages on a daily basis for different reasons, from simple ones like adding colors to the console.log()statements on our terminal to fully-fledged front-end libraries such as React. These packages increase our productivity and save us a lot of time by not having to rewrite things that have been implemented several times by tons of users.

In this post, I’ll introduce you to 10 NPM packages that you should check out if you’re learning React or already are an experienced user. We’ll be going over multiple domains such as UI frameworks to utility-based packages. Without further ado, let’s get started.

Material UI

Material UI is probably one of the best UI frameworks built for React, allowing you to build a consistent design system while leveraging Google’s Material Design. Material UI helps you in building and designing by providing over 50+ components such as cards, progress bars, modals, and a lot more, which you can further theme as per your requirements. If I had to recommend a UI framework to a React developer, Material UI would surely be my first choice.

Link to NPM Package

Redux Toolkit

Although the useContext and useReducer hooks have reduced the need of using Redux in modern applications, it’s not uncommon to see a lot of codebases still Redux for global state management. Redux is still a valuable skill to learn in my opinion and does have its own use cases. However, the amount of boilerplate it takes to set up Redux in your React application can be overwhelming, especially for beginners.

Redux Toolkit aims to solve just that! It is advertised as the official, opinionated, batteries-included toolset for efficient Redux development and is also highly recommended by the official Redux team to write your Redux logic. Do yourself and your codebase a favor by choosing Redux Toolkit over regular Redux next time.

Link to NPM Package

React Icons

React Icons is a marvelous package that consolidates icons from over a dozen of popular icon sets such as Font Awesome, Material Icons, Ant Design Icons, and more. This makes it extremely easy to have access to all your favorite icons just by installing a single package without having to install each of them individually. Through ES6 imports, you can make sure that you import only those icons which you intend to use.

Link to NPM Package

React Google Login

OAuth or Open Authorization enables users to sign up or log in to your website through other providers such as Google, Facebook, Twitter, GitHub, and more. You must’ve noticed the ‘Login with Google’ button on lots of popular websites. React Google Login allows you to accomplish the same functionality and makes the authorization process easy for you. All you need is an API key from Google and you’re set to implement Google OAuth in your website using this simple package.

Link to NPM Package


Formik makes the painstaking job of building forms in React easier by taking care of all the repetitive stuff such as keeping track of value state, change handlers, submit handlers, validation, and more. This form library is small, simple and encourages you to spend less time writing form code and focus on building your big thing. It is well documented and has a dedicated tutorial for you to get familiar with it.

Link to NPM Package

React Query

An essential part of a full-stack web application is fetching the data from your backend API or server state and loading them into your component or global state. If you’re using Redux, this process might be firing an action in your useEffecthook to fetch data from your backend when the component is mounted. Well, what if there could be a better alternative to this approach?

React Query is an excellent data-fetching library that is the perfect candidate for this use case. Not only fetching, but React Query is also capable of caching, synchronizing, updating server state, paginating, and even lazy loading. Everything you need to make your interactions with the backend more fruitful is baked into this library and I highly encourage you to give it a try. Alongside performance improvements, it will help you make your codebase cleaner and more maintainable.

Link to NPM Package

Styled Components

Styled Components is a CSS-in-JS library which JavaScipt’s tagged template literals to create styled HTML components. Why should you consider this over the regular CSS approach? Good question! Styled Components provides a component-like structure to your custom styled elements and saves you from typing className a bunch of times. Furthermore, it has some valuable features like automatic vendor prefixing and automatic critical CSS. Since Styled Components use the regular CSS syntax, you can transition pretty quickly to it.

Link to NPM Package


Axios is a promise-based HTTP client based on the XMLHttpRequest interface which helps you make HTTP requests in order to fetch some data. But wait, isn’t that what the native fetch() is used for. Well, yes. Just like other packages, the goal of this package is the simplify the process and provide more features such as automatic JSON data transformation, intercept request and response data, protect against XSRF, cancel requests and provide you a simpler API to work with for making HTTP requests.

Link to NPM Package

Framer Motion

Framer Motion is an amazing animation and motion library for React to make your websites more interactive and fun to look at. Just visit their landing page, and you’ll be blown off by the sheer ease to use and the number of features they provide ranging from general animations, gesture-based animations, drag animations, scroll animations and so much more. Let me put it this way: if you were on the lookout for animation libraries, look no further than Framer Motion.

Link to NPM Package


This particular package is especially useful if you’re Redux and are trying to improve the performance by avoiding unwanted expensive calculations. In a nutshell, Reselect is a selector library that allows you to efficiently compute derived data from the Redux store through memoization and by memoized selectors. If performance is key to your React-Redux application, definitely check out Reselect.

Link to NPM Package

So that was my list of 10 NPM packages that I think you should have a look at if you’re working with React. Let me what packages do you use to make your workflow simpler and more productive, I’d love to hear them. Until then, happy coding!

from Tumblr https://generouspiratequeen.tumblr.com/post/644259943169638400

3 software development trends to watch in 2021

3 software development trends to watch in 2021:


As digitization accelerates and to ensure developers are set up for success, companies should enable developer productivity and collaboration, prioritization and developer experience.

Businesses everywhere closed their physical doors and accelerated digital strategies due to the pandemic. So developers and DevOps teams were placed under a lot of pressure to build new experiences to support remote work and customers, maintain productivity and continue operations digitally.

So, what’s next? COVID-19 has reshaped much of the business landscape and forever changed how some jobs will function. How different will work be for software developers in 2021, and what should be top of mind? Below, I unpack some of the biggest trends from 2020 that will continue into 2021 – and beyond.

1. Quality-of-life improvements for better developer experiences

Developers were better positioned than many other jobs to go remote in 2020. Most were already accustomed to working digitally and using workplace collaboration tools to boost productivity. But the transition wasn’t without its pain points.

Development and DevOps teams were under ever-increasing pressure to build and operate mission-critical applications as businesses pivoted to 2020’s ever-changing conditions. Developers have long communicated, planned, coordinated and executed activities using digital tools, but in 2020 these tools became the only way to collaborate. Large open office spaces overrun with white boards and impromptu ideation sessions were replaced with endless scheduled virtual meetings. In 2021 we will see organizations invest in tools that try to enable more visceral and on-demand collaboration, to recapture the spark and fidelity of real-life interaction.

We’re also seeing that working from home during a pandemic is blurring the lines between work and home life for the development community. GitHub, the largest code repository system in the world, shows that developers are writing more code during COVID-19 than they ever did before. Companies need to tread lightly here, ensuring their developer teams don’t get burned out. It’s one thing if code is a developer’s place of solace and comfort. But if your people are coding for work, for long hours – that’s not ideal for anyone since it may not be good for their psyches and may mean less stable code.

2. Greater focus on ROI and mapping to business KPIs

In recent years, it’s been popular to think about the role of developers as “disruption-proof.” This is true to an extent, as the potential for future growth for businesses lies in the ability to use software and harness data. But with continued economic uncertainty in 2021, there will be pressure on every part of the business to demonstrate in crystal clear terms why it deserves its budget.

With the explosion of digital transformation needs and businesses working toward digitizing more workflows and back-office tasks, there’s a bigger backlog than ever of things to digitize. And given the economic conditions, it’s unlikely that budgets will increase. Yet, there will be a lot of pressure on developers and development teams to make sure their efforts are focused on areas that are most critical for the business. Clear KPIs are going to be imperative to better understanding the business value developers are driving.

Indeed, with fewer resources and management expectations just as high, there needs to be a crisp strategy so companies can prioritize better from a developer standpoint and make sure that everything they are working on adds to the bigger company goals and objectives. COVID-19 has brought us to a “no excuse” scenario. Companies need to be digitizing. And even after the pandemic fades, expectations for digital experiences won’t go back to what they were pre-COVID-19.

3. Low-code and ever more powerful pro-code

Rapid progress of developer capabilities will continue in 2021, with many developers considering how to harness the increased capabilities of edge computing and the implications of 5G, and even pondering the science fiction-like possibilities of quantum computing. Yet at the same time, low-code/no-code tools will continue increasing in popularity, and developers will have to consider how to adjust to a world where non-developers can build apps too.

Putting the power of development capabilities in the hands of non-developers has been one of the longest-standing quests of software providers. And over the years, great strides have been made. Adobe Experience Manager, for instance, has long enabled marketers to create pixel-perfect digital experiences without always having to tap front-end developers to help. But the promise of general-purpose low-code/no-code platforms have come and gone every decade. Why is this time different?

As the onslaught of digital transformations needs has intensified, many low-code/no-code platforms have focused efforts to enable the development of back-office apps and workflows. This allows low-code creators to concentrate on business areas that might conform more easily to the form-driven nature of many low-code/no-code tools. Innovations in AI have also enabled low-code creators to build rich virtual agents for powering end-user conversational experiences. In 2021 we will see more non-development teams creating mission-critical apps using low-code/no-code tools. We will also see an increase in multidisciplinary teams that include developers to assist in proper low-code/no-code app development, and in connecting more data and services to low-code tools.

Keep an eye on these developer trends

It’s safe to say that developers were key to business resilience in 2020 and that they will continue to be a driving force behind the digitalization of enterprises in 2021, as contactless experiences continue to be the norm. For companies, enabling developer productivity and collaboration, prioritization and a focus on developer experience will be key to how developers provide value to businesses in every industry and in companies of many different sizes.

from Tumblr https://generouspiratequeen.tumblr.com/post/644112725177417728

Ecommerce: Digital Marketing for Brand Awareness and Boosting Sales

Ecommerce: Digital Marketing for Brand Awareness and Boosting Sales:

Have you ever wondered what it feels like to try something new? Have you ever felt like bringing in new technology and keeping up with the latest trends rather than sticking to the traditional method?

Are you worried about not understanding the latest technology and dependent on the traditional marketing structure to promote your products and boost sales? The best part of practicing digital marketing is that you need only three requisites: Strategy, capture audience attention, and generate conversions. Now, this may seem easy to read but tough to follow, so I think it’s time to learn about a few definitely helpful digital marketing tips to boost your sales.

What is Digital Marketing?

Digital Marketing is the component of marketing that utilizes the internet and online-based digital technologies such as desktop computers, mobile phones, and other digital media and platforms to promote products and services. (Source: Wikipedia). Over the years, it has received substantial recognition allowing the rapid growth of digital marketing. The term is also referred to as Online Marketing or Internet Marketing because of its constant marketing activities specifically for the web. 

Digital Marketing for Brand Awareness and Boost Sales

Yes, we have learned that digital marketing is essential to create awareness and lead to increased sales. But, digital marketing also helps companies have a global presence without having to set offline stores all over the world. Digital Marketing begins from having an online presence until Call to Action (CTA), including SEO and content marketing. So, let us learn a few essential ways to create brand awareness and boost sales.

1. Set Up a Welcoming Website

The biggest mistake new companies, startups, or medium-sized companies make is that they don’t want to invest in a website. Companies believe that they should concentrate on sales and marketing rather than creating a webpage. Wrong.! Website increases a customer’s trust in you, and it is like your address. In offline marketing, customers visit your store and are sure of your authenticity, but how will you create faith and relationship in online marketing? Through Websites! Thus, creating a User-friendly, SEO-driven, and Call-to-Action website is extremely important.

Image Source

2. Content Marketing

The objective of Content Marketing is to reach your target audience by sending interactive and attractive content. Thus, ultimately leading to a specified Call to Action (CTA) such as ‘Buy Now’, ‘Read More’, ‘Learn More’, ‘Register Now’, ‘Apply Now’, and many more. Also, to keep your content engaging and interactive, few examples of types of Content Marketing are:

  • Blogs and Articles
  • Infographics
  • Ebooks
  • Podcasts
Image Source

3. Use SEO Keywords

The primary purpose of using SEO (Search Engine Optimization) keywords is to have a good ranking in search engines. Content Marketing and creating a Website are easy but creating an SEO driven website, or content is the tricky part. You have to ensure that the SEO keywords are relevant to your content and there isn’t any keyword stuffing. Also, choose the keywords wisely to help your content appear on the top of the search engine results. 

“Around 75% of the consumers never read past the first page of the search results” mentioned in Hubspot

4. Strategic Email Marketing

Email Marketing is considered as an essential and effective tool to reach your customers. They help in completing a course of action (for e.g., Incomplete Shopping Cart), awareness of product updates and latest offers, greeting and engaging with customers, and much more. Remember: Include content and images/videos. Keep it short and appealing. Add Call to Action. Prepare an attractive design.

“Nearly 9 marketers out of 10 make use of Email Marketing for an organic approach of content marketing” Statistics mentioned by Oberlo.

5. eCommerce Automation

One of the most effective and certain ways to ensure smooth functioning and organized intervals of email marketing is through eCommerce automation. Let’s just say it loud, ‘eCommerce Automation makes your professional life easier. Most of the tasks are taken care of by this tool, and by setting a few triggers, you can consistently send emails to your customers. Thus, you don’t have to send hundreds of emails manually and each time prepare an email for a specific task.

For Example: You have set a trigger for ‘Send an email if incomplete payment process for existing shopping cart’. Unfortunately, eight (8) customers did not complete the payment process, and products are left in the shopping cart. 

Thus, instead of you having to search such customers and send them reminder emails for each of them, eCommerce automation sets triggers and automatically sends an email asking them to complete the process. 

Image Source

6. Popups and Call To Action

Do you keep your audience engaged? If not, you need to keep your customers informed and engaged with the company’s activities. Thus, add a popup to your website during special occasions to attract customers. Popups are a great way to attract customers, and some of the most innovative popups are: creating a giant ‘Spin to Win’ wheel, also known as ‘Gamified’ Popups, and Full-Screen Popups. Also, add relevant call to action buttons for your customers to understand their next course of action. This helps in increasing sales by encouraging customers to perform an action.

For Example: ‘Special Offer: 25% Off on account of our five (5) year anniversary. Grab this offer soon’. This is a Popup.

In the same popup, add the ‘Shop Now’ or ‘Avail this Offer’ button. This is popularly known as a Call To Action (CTA) button. 

Image Source

7. Engage in Social Media Platform

Create your social media presence by creating awareness of your company through various social media platforms. A few of the most popular and most operated social media platforms are Facebook, LinkedIn, Twitter, Instagram, Pinterest, and many more. Create your company page and engage with your target audience through social media posts. Make sure to choose the right platform in lieu of your company’s interests.

For ExampleLinkedIn is an exemplary platform for professional and Business-to-Business audiences, while Facebook and Twitter have more informal and casual approaches. 

8. Use Paid Advertising

When organic methods of brand awareness are taking time, you can always try paid advertisements. Identify your target audience correctly, and with the use of Google Ads, choose the targeted keywords. Your advertisements will be displayed right on the Google search results front page with the right keyword placements. Depending on your ad, it may be placed directly below the search bar, end of the first page of the search results, or on the right side of the page.

For Example: You run a sports footwear company and want to target the ‘men’ audience needing ‘shoes’ for ‘football’ at ‘discounted price’. Your advertisement may look like this, ‘Men Football Shoes: Discounted price starting from 20% off. Buy Now.’


Digital Marketing is a short term with a vast and in-depth meaning towards it. It is a pure source of increasing traffic, increasing sales, and highlighting brand awareness. With the help of eCommerce automation, a few of the digital marketing activities, such as Email Marketing, become way quicker and more comfortable. You can send emails related to your customers just by setting up a few triggers. Before signing off:

  • Remember to create a successful digital marketing strategy.
  • First, make sure you have: SEO-friendly content.
  • Select your target audience.
  • Define your Call to Action and add a Call to Action button. 

from Tumblr https://generouspiratequeen.tumblr.com/post/644112723701006336

React useEffect() hook tutorial for begginers

React useEffect() hook tutorial for begginers:

 In this post I will show you the usage of useEffect hook. Which is really really important if you are a reactjs dev. So if you are interested to learn it, continue reading….

Before using this hook, we have to import it from react.

import React, {useEffect} from 'react';

So what is the use of this hook and how do we use it? useEffect Hook lets you perform side effects in functional components. It performs an action once the page loads for the first time. Example:- Fetching requests, manipulating DOM directly, using timer functions like setTimeout(), and more. The component rendering and side-effect logic are independent. So it would be a mistake to perform side-effects directly in the body of the component. Let’s try to use this hook………

useEffect(() => {
    // put your code here
  }, dependencies)

This is the syntax of useEffect hook. It takes a callback function and an argument which is called dependencies. Dependencies is an optional array of dependencies. useEffect() executes callback only once the page loads…

useEffect(() => {
    console.log("HI there");

In this code, I don’t have any dependencies. It has printed – ‘hi there’ for a single time after the page has been loaded.

The dependencies of useEffect()

Dependencies are some arguments of useEffect hook. So with this arguments, you can control the side effects. To do that, we pass our dependencies under an array. But at first let’s try with an empty array and let’s see what happens.

useEffect(() => {
    console.log("HI there");
  }, []);

It has printed – ‘hi there’ for a single time after the page has been loaded.

Now look at the code below.

import React, { useEffect, useState } from "react";

const App = () => {
  const [state, setState] = useState(0);
  useEffect(() => {
    console.log("HI there");
  }, [state]);
  return (
          setState(state + 1);
        Click Me

export default App;

Here in this code, I just have a button. Which will increment the current value of our state. And in useEffect I have put the state variable as a dependency of the hook. So what will be happened here?

This will execute the code under the callback every time the value of our state variable changes. You can perform any action here. And you can also perform multiple actions.. no problems or error’s will be seen.

Fething Data

Now I will show you how fetch some data’s from an api using useEffect hook.

import React, { useEffect, useState } from "react";

const App = () => {
  const [state, setState] = useState(0);
  const fetchData = async () => {
    const api = fetch("https://jsonplaceholder.typicode.com/todos/");
    const apiData = (await api).json();
    setState(await apiData);
  useEffect(() => {
  }, []);
  return (

I am fething some fake datas

); }; export default App;

So let me explain you. I have a fake api which is giving me some fake data’s. Now to fetch them in a React way, you have to use this useEffect hook.

And if you pass an async function as a callback under useEffect, it’s not gonna return you anything. So I have passed a function there. Which is an asyncronous function and I am fetching the data from the api. Then I am storing the api data under my state variable and printing it in my console. That’s all. Hope you are familiar with fetch api 😅

Clean up function

Cleanup works in this following ways:

1. After initial rendering, useEffect() invokes the callback having the side-effect. cleanup function is not invoked.

2. On later renderings, before invoking the next side-effect callback, useEffect() invokes the cleanup function from the previous side-effect execution (to clean up everything after the previous side-effect), then runs the current side-effect.

3. Finally, after unmounting the component, useEffect() invokes the cleanup function from the latest side-effect.

Let me show you an example.

import React, { useEffect, useState } from "react";

const App = () => {
  const [state, setState] = useState(window.innerWidth);
  const resizeD = () => {
  useEffect(() => {
    window.addEventListener("resize", resizeD);
  }, [state]);
  return (


); }; export default App;

Here I have a simple piece of code. Which giving me a live preview of my screen size. I have a useEffect here, which will be called every time when my variable value changes. And I am rendering the value of our variable under h1. So in this case, the state variable is changing every time when we resize the window. And if you print the value of the state variable in the console, you will see it is printing too many ( every time you resize the window ) times but it not removing anything. Which is not a good stuff. So in this case you application may crashed or the client may have a bad experience. So we use cleanup functions in useEffect. It immidietly removes the value when another new value exists for the same variable.

Before adding cleanup function –

Now let’s add a cleanup function-

    return () => {
      window.removeEventListener("resize", resizeD);

That’s all now the whole code will be look like that ->

import React, { useEffect, useState } from "react";

const App = () => {
  const [state, setState] = useState(window.innerWidth);
  const resizeD = () => {
  useEffect(() => {
    window.addEventListener("resize", resizeD);
    return () => {
      window.removeEventListener("resize", resizeD);
  }, [state]);
  return (


); }; export default App;

After adding a cleanup function ->

Did you see that now it is removing the previous data, when any new data exits for our variable. So this clean up function can increase you application performance. If there is any other use of this clean up function, please let me know.

So That’s all I know about useEffect hook. Hope you enjoyed that. If you have any issue regarding that post, please let know. And make sure you follow me to receive all the informational posts just like that one.

from Tumblr https://generouspiratequeen.tumblr.com/post/644022130097471488

9 Useful WordPress Plugins For Your 2021 Projects

9 Useful WordPress Plugins For Your 2021 Projects:

 Finding just the right plugin can make a huge difference in the success of a WordPress website.

Some of these plugins are relatively new. Others, that have been around for a while, continue to improve like a fine wine thanks to occasional updates by design and development teams who keep the best interest of their plugin’s users in mind.

In any event, you won’t find a WordPress plugin here that suffers the maladies that so many of their cousins and competitors exhibit, like bad coding that can create compatibility issues, or bugs that compromise the quality of a WordPress theme’s features and functionality.

If, as you go through this selection of 9 WordPress plugins, you find one you believe will be helpful to have and use and could easily make your day, don’t hesitate to select it. 

1. Amelia WordPress Booking Plugin

We’ll start with an award-winning implementation of PHP and VueJS code that can benefit your business in several ways.

  • Amelia manages appointment and event booking for you.
  • It saves you from dealing with missed or improperly scheduled appointments resulting from human inattention or error.
  • Customers or clients can book and/or change an appointment online 24/7 from the front-end.  
  • Clients and employees have separate front-end panels that enable them to take full advantage of Amelia’s UI and UX features. Although Amelia is a WordPress-based plugin, clients do not have to log into WordPress to access the application.


  • Amelia can serve multiple business locations. The unlimited number of employees working at more than one place can connect with their Google and Outlook calendars to avoid scheduling problems or issues.
  • Amelia can be used to manage events and attendees.

Click on the banner to find out more about how this WordPress booking plugin can save your business time and money and relieve you of appointment booking woes.

 2. wpDataTables 

The banner nicely summarizes what wpDataTables can do, but while it saves time to use a tool like this to build a table or chart instead of doing so manually, it doesn’t show the sheer power and performance this plugin brings to the table.

For example:

  • wpDataTables can accept data from multiple sources and in the most-commonly-used formats, including real-time My SQL information.
  • wpDataTables can process thousands upon thousands of rows of data in seconds or minutes as opposed to hours or days it would take to do so manually or with most other table-building tools.
  • wpDataTables can apply advanced filtering and search capabilities
  • Online tables and charts can be edited and are easily maintainable.
  • Conditional formatting allows key information to be color-coded or highlighted
  • Tables and charts are fully responsive

It is also worth noting that the wpDataTables documentation is comprehensive and extremely informative.

3. WPC Product Bundles for WooCommerce

WPC Products Bundles addresses a sales and marketing strategy that could often prove to be difficult to achieve online using manual product bundling techniques.

There is much more involved than simply selecting individual products and offering them at a discounted price when they are bundled together.

This plugin:

  • Combines simple products, variable products, or particular variations of products for selling at a special price
  • Automates the inventory management, tax and shipping charges, and invoicing of product bundles
  • Calculates discount amounts or percentages and takes into account coupons or other special promotions
  • Easily integrates with other WPC plugins including Product Timer, Fly Cart, and Ajax Add to Cart, for enhanced WooCommerce site performance and UX.

If product bundling one of your sales and marketing strategies or is under consideration, WPC Products Bundles can save you a ton of time while improving your bottom line.

4. LayerSlider

LayerSlider has much more going for it than the title implies. One of the most solidly established products on the market, and serving a huge user base, LayerSlider is a fully-loaded multipurpose tool for content creation.

LayerSlider offers –

  • Extensive animation capabilities
  • Fancy popups to maximize your site’s conversion rates
  • Hundreds of pre-made templates for sliders, landing pages, and more

LayerSlider is SEO and mobile device friendly. Click to find out more.

5. Logic Hop – Content Personalization for WordPress

Personalization is a game changer for marketers. The ability to target and message users based on behavior boosts conversion rates to new levels. Fully integrated with WordPress, Logic Hop lets you use real-time data to target visitors and show personalized content anywhere on your site. 

Logic Hop is the best personalization tool on the market – Easy enough for beginners and tons of advanced features for power users.

Try Logic Hop and see what personalization can do for you.

6. Slider Revolution

A WordPress plugin that saves you hours or days of work is worth its weight in gold, and it’s a definite bonus when the same plugin makes it as easy as can be to “Wow” clients and customers with professional looking visuals.  

  • Slider Revolution comes with 200+ templates to get your project started
  • A 2,000+ element library is also included
  • 25+ add-ons offer keys to success

Click to learn more about “Wowing” your clients.

7. Heroic Inbox

Email saves customer support organizations time and money. Managing an email inbox can significantly eat into those savings. Heroic Inbox enables an organization to approach Inbox Zero, the amount of time spent managing inbox content.

Heroic Inbox –

  • Enables support staff to collaborate on email responses
  • Streamlines support workflow
  • Provides users with a snappy UI
  • Measures email support performance

With Heroic Inbox, Inbox Zero will no longer be something you’ve simply read about.

8. Ads Pro Plugin – Multi-Purpose WordPress Advertising Manager

What goes into creating an “Insane” ad manager for WordPress? The Ads Pro designers had no problem figuring that out.

The tools you’ll find in this plugin include –

  • 25+ responsive, ready-to-go ad templates
  • 20 different ways to display ads
  • Geotargeting, scheduling, filters, hooks, caps, and more
  • 3 Billing modules and 4 Payment Methods

The Ads Pro Admin panel helps you pull all of these together while the Frontend User Panel is there to serve your client.

9. Flow-Flow Social Feed

The ability to increase a websites’ conversion by adding social media proof is not an easy thing to accomplish; especially when you want to display not just one, but a mix of social media feeds.

  • Flow-Flow Social Feed does the necessary aggregating and displaying a mix of social feeds on WordPress website.
  • It’s highly customizable and requires no coding
  • Flow-Flow has option to operate via the Cloud

Flow-Flow is an Envato best-seller. A free version is also available.

WordPress plugins provide a convenient way to add, extend, or upgrade functionality to WordPress and to your site.

The plugins featured here are the best in their respective categories. They can serve as website building blocks to take your site’s performance and functionality to a higher level.

Any one of the above plugins can improve your site’s performance and make your day at the same time.

from Tumblr https://generouspiratequeen.tumblr.com/post/644022129607720960

What Is The Javascript Event Loop?

What Is The Javascript Event Loop?:

 Javascript is single-threaded,i.e, it executes only one operation at a time. This process of executing only one operation at a time on a single thread is the reason we say javascript is synchronous. But then what happens if a task takes too long to complete? Will all the other tasks be halted as we wait for this particular task to complete? This could clearly slow down our applications. To avoid such implications, javascript has a concurrency model based on the event loop that provides it with the ability to process multiple tasks asynchronously

This article will help you understand why javascript is single-threaded and yet asynchronous by learning about the javascript runtime environment, the event loop and the mechanisms behind it.

Javascript Runtime

Each browser has a Javascript runtime environment.
Here is an illustration to help us visualize the runtime.

So, the javascript runtime consists of

Javascript Engine

Each browser uses its different version of the javascript engine. Some of the popular ones are V8(Chrome), Quantum(Firefox) and Webkit(Safari). Inside the engine, we have a memory heap and a call stack.

Memory heap

Memory is allocated every time we create objects, declare functions or assign variables. This memory is stored in the heap.

Call Stack

The single-threaded nature of javascript is because it has only one call stack. Within the call stack, your javascript code is read and executed line by line. The call stack follows the First In Last Out (FILO) principle, the function that is first added is executed last. once a function gets executed it’s then get popped off the stack. Let’s look at some code to clear the concept.

const getMovie = () =>{
 console.log ('Avengers')
// Avengers

Enter fullscreen mode Exit fullscreen mode

Here is how the JS engine handles this code…

  • first, it parses the code to check for syntax errors and once it finds none, it goes on to execute the code.
  • it sees the getMovie() call and it pushes it to the stack. 
  • getMovie() calls console.log() which then gets pushed to the top of the stack… 
  • JS engine executes that function and returns Avengers to the console. The log is then popped off the stack. 
  • The javascript engine then moves back to the getMovie() function, gets to its closing brackets and pops it off the stack(as it’s done executing). 

    As illustrated, the functions are added to the stack, executed and later deleted. Note that the function at the top of the stack is the one on focus and the JS engine only moves to the next frame(each entry in the call stack is called a stack frame) when the one above is returned and popped off the stack. This process of the call stack returning the frame at the top first before moving on to the next is why we say the JS engine runs synchronously.

Now suppose you want to fetch some data from an external file or you want to call an API that takes a while before it returns, You want the users to be able to continue using the program while waiting for the response, you cannot afford for your code to stop executing, javascript has a way to make this possible and here is where we introduce the Web APIs.

Web APIs

The Web APIs are provided by the browser, they live inside the browser’s javascript runtime environment but outside the javascript engine. HTTP, AJAX, Geolocation, DOM events and setTimeout are all examples of the web APIs. Let’s use a code example to help us figure out how web APIs help us in writing asynchronous code.

console.log ('1') // outputs 1 in the console
const getNumber = () =>{
//in this setTimeout, we set the timer to 1s (1000ms = 1s)
//and pass a callback that returns after 1s
}, 1000)
Enter fullscreen mode Exit fullscreen mode

Let’s evaluate how javascript runs this code and its output

  • as usual, first, it parses the code looking for syntax errors and on finding none, it continues to execute the code.
  • the first console.log is pushed to the stack, 1 is returned and its popped off the stack.
  • the next function, getNumber(), is pushed to the stack

  • getNumber() calls the setTimeout which is part of the web APIs, remember?

  • When the setTimeout is called to the stack, the callback with the timer is added to the appropriate web API where the countdown starts. The setTimeout is popped out of the stack.

  • getNumber() is done returning and consequently removed from the stack.

  • the last console.log is added to the stack, returns 3 to the console, and removed from the stack.

    So, what happens after 1s and the timer countdown is finished? You would think that the callback is popped back from the web API to the call stack, but if it did this, the callback would randomly appear in the middle of some other code being executed, to prevent such a scenario, web API adds the callback to the message queue instead.

The message queue is basically a data structure that javascript runtime uses to list messages that need to be processed. Unlike the call stack, the message queue uses the First In First Out(FIFO) principle, The first function added to the queue is processed first.

Now, how does javascript runtime know that the stack is empty? or how do events get pushed from the message queue to the call stack? enter the event loop.
The job of the event loop is to constantly monitor the call stack and the message queue. If the call stack is empty, it takes the first event on the message queue and pushes it to the call stack. Both the call stack and the message queue may be empty for some time, but the event loop never stops checking.

Back to our code, the event loop checks and sees that the call stack is empty, so it pushes our callback (cb) to the stack where it returns 2 to the console and is then removed from the stack. Our code is done executing.

In addition

What would happen if we passed 0 milliseconds to setTimeout?

const getCurrency = ()=>{
}, 0)
const name = () =>{
// Frank
// dollar
Enter fullscreen mode Exit fullscreen mode

If you copy the above code and view it in the console, you shall notice that Frank is printed first and then dollar. Here is how JS handles this code:

  • first, it parses the code looking for syntax errors before going on to execute it.
  • getCurrency() is pushed to the stack.
  • getCurrency() calls setTimeout, JS engine sees its a web API and thus adds it to the web APIs and setTimeout is popped off the stack. getCurrency() is also removed from the stack.
  • Since the timer is set to 0s, web API immediately pushes the callback to the message queue, consequently, the event loop checks to see if the stack is empty, but it’s not because
  • as soon as setTimeout was removed from the stack, name() got pushed to the stack immediately.
  • name() calls console.log which returns Frank and pops off the stack.
  • name() is done returning and is removed from the stack too.
  • The event loop notices that the call stack is now empty and pushes the callback from the message queue to the call stack.
  • The callback calls console.log, which returns dollar and pops off the stack. The callback is done executing and is removed from the stack. Our code is finally done executing.

This code shows us that calling the setTimeout with a delay of 0 milliseconds doesn’t execute the callback after the specified interval, the delay is the minimum time required by the runtime to execute the callback and not a guaranteed time.
The callback has to wait for other queued messages to complete and the stack to clear before it’s pushed to the stack and returned.


Knowledge of the javascript runtime helps you understand how javascript runs under the hood and how different pieces fit together to make javascript the great language as we know it. I hope this article gave you a solid grasp of this fundamental concept. See yah!

from Tumblr https://generouspiratequeen.tumblr.com/post/643931533681590272

Getting Deep into Shadows

Getting Deep into Shadows:

 Let’s talk shadows in web design. Shadows add texture, perspective, and emphasize the dimensions of objects. In web design, using light and shadow can add physical realism and can be used to make rich, tactile interfaces.

Take the landing page below. It is for cycling tours in Iceland. Notice the embellished drop shadow of the cyclist and how it creates the perception that they are flying above not only the content on the page, but the page itself, as though they are “popping” over the screen. It feels dynamic and immediate, which is perfect for the theme of adventure.

Credit: Kate Hahu

Compare that with this next example. It’s a “flat” design, sans shadows. In this case, the bike itself is the focal point. The absence of depth and realism allows the bike to stand out on its own.

Credit: saravana

You can appreciate the differences between these approaches. Using shadows and depth is a design choice; they should support the theme and the message you want the content to convey.

Light and shadows

As we just saw, depth can enhance content. And what exactly makes a shadow? Light!

It’s impossible to talk about shadow without getting into light. It controls the direction of a shadow as well as how deep or shallow the shadow appears. You can’t have one without the other.

Google’s Material Design design system is a good example of employing light and shadows effectively. You’ve certainly encountered Material Design’s aesthetics because Google employs it on nearly all of its products.

The design system takes cues from the physical world and expresses interfaces in three-dimensional space using light, surfaces, and cast shadows. Their guidelines on using light and shadows covers this in great detail.

In the Material Design environment, virtual lights illuminate the UI. Key lights create sharper, directional shadows, called key shadows. Ambient light appears from all angles to create diffused, soft shadows, called ambient shadows.

Shadows are a core component of Material Design. Compare that with Apple’s Human Interface Guidelines for macOS, where translucency and blurring is more of a driving factor for evoking depth.

In this case, light is still an influential factor, as it allows elements to either blend into the desktop, or even into other panels in the UI. Again, it’s is a design choice to employ this in your interface. Either way, you can see how light influences the visual perception of depth.

Light sources and color

Now that we understand the relationship between light and shadows, we ought to dig in a little deeper to see how light affects shadows. We’ve already seen how the strength of light produces shadows at different depths. But there’s a lot to say about the way light affects the direction and color of shadows.

There are two kinds of shadows that occur when a light shines on an object, a drop shadow and a form shadow.

Drop shadows

drop shadow is cast when an object blocks a light source. A drop shadow can vary in tone and value. Color terminology can be dense and confusing, so let’s talk about tone and value for a moment.

Tone is a hue blended with grey. Value describes the overall lightness or darkness of a color. Value is a big deal in painting as it is how the artist translates light and object relationships to color.

In the web design world, these facets of color are intrinsic to the color picker UI.

Form shadows

form shadow, on the other hand, is the side of an object facing away from the light source. A form shadow has softer, less defined edges than a drop shadow. Form shadows illustrate the volume and depth of an object.

The appearance of a shadow depends on the direction of light, the intensity of light, and the distance between the object and the surface where the shadow is cast. The stronger the light, the darker and sharper the shadow is. The softer the light, the fainter and softer the shadow is. In some cases, we get two distinct shadows for directional light. The umbra is where light is obstructed and penumbra is where light is cast off.

If a surface is close to an object, the shadow will be sharper. If a surface is further away, the shadow will be fainter. This is not some abstract scientific stuff. This is stuff we encounter every day, whether you realize it or not.

Light may also be reflected from sides of an object or another surface. Bright surfaces reflect light, dark surfaces absorb light.

These are the most valuable facets of light to understand for web design. The physics behind light is a complex topic, I have just lightly touched on some of it here. If you’d like to see explicit examples of what shadows are cast based on different light sources, this guide to drawing shadows for comics is instructive.

Positioning light sources

Remember, shadows go hand-in-hand with light, so defining a light source — even though there technically isn’t one — is the way to create impressive shadow effects. The trick is to consistently add shadows relative to the light source. A light source positioned above an element will cast a shadow below the element. Placing a light source to the left of an element will cast a shadow to the right. Placing multiple light sources to the top, bottom, left and right of an element actually casts no shadow at all!

A light source can be projected in any direction you choose. Just make sure it’s used consistently in your design, so the shadow on one element matches other shadows on the page.


Shadows can also convey elevation. Once again, Material Design is a good example because it demonstrates how shadows are used to create perceived separation between elements.

Credit: Nate Wilson

Inner shadows

Speaking of elevation, the box-shadow property is the only property that can create inner shadows for a sunken effect. So, instead of elevating up, the element appears to be pressed in. That’s thanks to the inset keyword

from Tumblr https://generouspiratequeen.tumblr.com/post/643931532928663552

Dark Mode in Emails: All the Secrets Revealed

Dark Mode in Emails: All the Secrets Revealed:

Dark Mode compatibility in emails is transcending from its definition as a “trend” and growing to be a best practice.

Owing to its immense popularity, you can conveniently name it as the fastest-growing trend that has cast a magic spell on apps, browsers, and of course email inboxes. It has enhanced the subscriber experience and taken it to the next level. 

Let’s first understand the definition of Dark Mode:

As the name suggests, Dark Mode represents a reversed color scheme in which white font is used in a dark background. 

This brings us to the next question: Why do people prefer to access their emails and other things in the Dark Mode theme?

The answer is in these four advantages that Dark Mode presents to its users.  

  1. Dark Mode theme is less stressful for the eyes, especially when the rooms are not that illuminated. 
  2. It helps to save battery life with minimum screen brightness. 
  3. Your content becomes more legible so that more people will be able to read and consume it. 
  4. It imparts a classy look and feels to the email. 

Despite these advantages, there are some challenges that come while rendering emails in Dark Mode.

1. Depending on the email client, Dark Mode emails get rendered in three different ways. 

  • The email remains unchanged

    When you access an email in desktop, web, and legacy email clients, it will remain unchanged irrespective of the mode you open it in. If you have maximum subscribers using these email clients, you can heave a sigh of relief as you will not have to make any additional coding changes in the emails. 
  • The colors get inverted

    This is the most challenging part when it comes to Dark Mode emails. Email clients will make an attempt to invert the colors in your email to support the Dark Mode settings. 

    In this type of setup, light colors will become darker and darker colors will turn lighter. 

    Consequently, your emails might not be displayed the way you want them to. 

    This color inversion can either be partial or full. 

    Partial color inversion, thankfully, will not create much problem for the email developers or readers. In stark contrast with that, full-color inversion will affect renderability to a huge extent. 

    Outlook.com, Outlook 2019 for Mac and Windows, Outlook apps on iOS and Android, and Gmail App on Android and iOS are the email clients that invert the colors in Dark Mode settings. 

  • The Custom Dark Mode

    Apple has always been ahead of its competitors and Dark Mode is no different. Apple Mail on macOS and iOS will give you an opportunity to code custom emails for light and Dark Mode with the help of CSS. You will be able to change the visuals, background, and font colors through CSS, HTML meta tags, and other properties. 

2. If you fail to design a Dark Mode compatible email, it will negatively impact the deliverability due to rendering issues. 

3. When it comes to accessibility, Dark Mode settings might cause problems to some readers and the readability gets hampered. 

4. Not every brand personality will be aligned to Dark Mode email. 

If you are curious to know the coding mantras and compatibility of Dark Mode in email clients with details on its high rate of early adoption and some Dark Mode design and coding tips, just head to this insightful infographic by Email Uplers: In the Limelight: Dark Mode in Emails

It will surely enlighten you and clear all the haze around Dark Mode in emails.

from Tumblr https://generouspiratequeen.tumblr.com/post/643840936781234176