let
: Variables can be reassigned, but can’t be redeclared in the same scope.const
: Variables must be assigned an initial value, but can’t be redeclared in the same scope, and can’t be reassigned.- Hoisting: Before any JavaScript code is executed, all variables are hoisted, which means they're raised to the top of the function scope.
- Temporal dead zone: If a variable is declared using
let
orconst
inside a block of code, then the variable is stuck in what is known as the temporal dead zone until the variable’s declaration is processed. - Suggested to ditch
var
in place of usinglet
andconst
. - Template literals: Denoted with backticks ( `` ), template literals can contain placeholders which are represented using
${expression}
. - Examples:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* | |
* MCrypt API available online: | |
* http://linux.die.net/man/3/mcrypt | |
*/ | |
#include <mcrypt.h> |
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
const ImageLoad = React.memo(({ src, placeholder, alt = "" }) => { | |
const [loading, setLoading] = useState(true); | |
const [currentSrc, updateSrc] = useState(placeholder); | |
useEffect(() => { | |
// start loading original image | |
const imageToLoad = new Image(); | |
imageToLoad.src = src; |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.