Useful form snippets for multiple selections

When building forms it is useful to have widgets that select multiple values for you and enhance UI, if you have large select list I would recommend to use select2 module to make custom form use its widget you should first get an array of elements in a variable, like 

Fastly and other CDN batch error

As Batch is dependent on the order of query string parameters if you are using Fastly or some other CDN they often have "Query String Sort" enabled or it is a good practice to do that, as it will result in more cache hits for you.

Make patch from current diff in module

Want to make a quick patch for changes you made in some contrib module to submit it to ?
Write down this and submit the file

git diff  > my_changes.patch


Get all methods you can run on fields

To get all method names you can run on any field added to any entity, input this into devel/php



Order life cycle in drupal commerce

Drupal commerce has rather good documentation for D8 commerce but I will try to summarise here how each order is made, what it needs to be completed and what goes on in lifespan of an order.
So lets start by order entity it self, check