This little tip adds just that extra good feeling for your webmasters. And a click less to the "Add content" page.
The following snippet makes you format a date field inside a twig file.
You often need to get the current language in your Drupal 8 custom modules or theme. Here's how to get it.
Sometimes you want to import specific config files, out of your main config library. Here's a drush snippet which does exactly that.

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 "" uuid


Easy snippet to get your current language:

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