PHP Fatal error: entity type does not exist

If you somehow get into this nasty problem, you have probably made some big mistake and now you are missing entity definition in your database. To quickly fix that you need to recreate it, you can use drush for it.  So if you are lucky find in code where this entity was added, probably in some hook_update in module.install file 

Database tables created that are not from entity definitions

If you browse around the DB tables in your drupal site, you might stumble into tables with double underscore names like commerce_order__shipments, this is most probably a table created as part of drupal field API system, mostly created as a multivalue field for some entity. It could be created when user creates field in UI or it could be programmatically made, like here

Getting country name from country code

To get full country name you need to use CountryManager class and you can then get all the info you need.  So lets say you have some country code store in $shipping_code variable, to get full country name

Xdebug profiler on Mac OSx

Calling this 3 commands should help you install qcachegrind so you can read xdebug profiler files you made

# Install qt
brew install qt

# Install qcachegrind
$ brew install qcachegrind
 
# Install graphviz
$ brew install graphviz

run qcachegrind in CLI and it will open up app in window where you can import profile file.

Run composer without "Discard changes" question

You want to keep composer quite and just do its job? Then either set that to your composer.json config with

composer config --global discard-changes true

Which will add that config to your config.json and everbody will have this setting or you can just make this one liner to keep it shut.

Checking all crontabs on server

To get all crontabs from users on your system write this one liner

for user in $(getent passwd | cut -f1 -d: ); do echo $user; crontab -u $user -l; done

to check other crons you need to see what is in for example 

ls -la /etc/cron.daily

or

How to login to drupal over postman or CLI (Authorization: Basic)

To login to drupal and POST/PATCH some endpoint over JSON:API you need to login first, this is simple over postman, just go to Authorization TAB, select Basic Auth and fill in your user/pass and this will be automatically added to your header. You could also make it manually adding header with calculated base64 username:password, which you can get with CLI and

JSON:API disable caching locally

To disable caching while testing your JSON:API endpoints you should put this into your settings.php

$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

but for this to work, you need to define this service null, which should be added as