When a drupal site has different domains for its language, difficulties can arise when developing locally. With the following snippet, you override your language settings, so prefixes are used instead of domains:

Add the following to your settings.php file:

$config['language.negotiation']['url']['source'] = 'prefix';

 

I personally like using the drupal menu block module. It allows for quick creation of submenu's. The following patch fixes a bug that keeps showing regions, even when there are no subitems in the menu block.
$date = strtotime($importObject->created_at); // which is a date format
$node->set('created', $date);
// $node->save(); etc

 

When saving nodes programmatically, you probably want to set the body to accept html. it is important to set the input format, so html is accepted.

From time to time it comes in quite handy to import configuration from other websites into yours. You site uuid is unique though, with the following snippet you get yours.

drush config-get "system.site" uuid

 

Easy snippet to get your current language:

// Get current language code
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();

 

I started using an automated script for my drupal installation, which will generate an admin user. But, after installation I have to edit the password.
I like a good user interface for webmasters, so a clear menu path is necessary. For the admin toolbar dropdowns, I usually create subitems programmatically. 
While there are many ways to debug your errors, sometimes just seeing the full errors in your screen works best.
A snippet with submitForm to redirect your form to another page and pass a variable.