Mysql create utf-8 database

Former practice:

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

Current practice:

CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Postfix localhost IP address only bind configuration

Open /etc/postfix/main.cf file:

bash# vi /etc/postfix/main.cf

Append / modify line as follows to bind to localhost (127.0.0.1) only:

inet_interfaces = 127.0.0.1

Type the following to restart Postfix:

bash# /etc/init.d/postfix restart

function memory_get_usage

 
<?php
 
function memoryChecker($variable) {
echo 'in function: '.memory_get_usage()."\n";
}
 
echo 'before function: '.memory_get_usage()."\n";
 
$var = "hello world\n";
 
memoryChecker($var);

Re-indent with PhpStorm

PhpStorm->Code->Reformat Code
or
Ctrl+Shift+Alt+L and click Reformat file

Git checkout single file

Checkout from other branch

git checkout develop /path/to/file.php

Checkout from HEAD

git checkout HEAD -- /path/to/file.php

Double ??

Before PHP 7:

if (isset($inputData)) {
    $param = $inputData;
} else {
    $param = 'default'; 
}

In PHP 7:

$param = $inputData ?? 'default';

or

$param = $inputData ?? $someData ?? 'default';

Css list with curly brackets

ol {
  counter-reset: list;
}
ol > li {
  list-style: none;
}
ol > li:before {
  content: counter(list) ") ";
  counter-increment: list;
}

Output:
1) Number1
2) Number2
3) Number3

Hard reset of local branch to match remote

git reset --hard origin/develop

See local changes not pushed to remote

git diff origin/develop..HEAD
git log origin/develop..HEAD

Benefits of running web app inside docker

Your server itself will not have a big stack installed, like LAMP: all your server needs to know is how to run docker containers.
If you deploy an app with a vulnerability and hackers gain root, they will only have root inside a single docker container, and can’t get at your host system.
If you want, you can run any number of docker containers on a single server by setting up a reverse proxy like nginx or haproxy