Drupal 8

Drupa 8 Custom Drush Command

If you need to create a custom drush command here is how this example Sets the home page via path not via node id (this one uses another core drush command)

First you need a module and a file in it that is has .drush.inc at the end of it

Example mymodule.drush.inc

then you need to do some thing like this:

Drupal 8 WorkBench EventSubscriber Example

Drupal 8 Event subscriber example for work bench moderation module.
say you want to do some thing when a work bench state changes ... this will get the logged in user vs the node content creator and get there enmails etc.

Service File:

    class: Drupal\test_even_subscriber\EventSubscriber\DefaultSubscriber
    arguments: ['@current_user']
      - { name: event_subscriber }