Add GIT branch to terminal prompt, works in your IDE also (PHPSTORM)

# Git branch in prompt.

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "

So open ~/.bash_profile in your favorite editor and add the above content to the bottom.

Rebasing commits to amend or group commits

So you made some mistake with your previous commit but dont want to make hundreds of commits and want to have nice looking reflog. You can do some rebasing with this command

Adding additional ssh-keys to your .ssh

Usually people will just create one key with just default command 

ssh-keygen 

get a public/private pair in (/Users/my_user/.ssh/id_rsa) and use that for anything, but there is much more to this then that. You can create many keys and use them for separate accounts and also automate that.

For example

How to get values from referenced entity

Assume we have a $node object and it has some reference field, we get to that field with 

$node->get($field)->referencedEntities();

where we get array of entites we can loop now, se lets say this reference field is even paragraph which has another reference field in it which is taxonomy term, we will loop this field like this

Coding cron job in Drupal 8

Coding a cron job in drupal 8 is pretty easy. All you have to do is go to your module folder, open .module file and add hook_cron function, so lets add some content with our hook_cron

Add BigInt type of data to your custom entity

To have integer go to BigInt type you will need to use setSettings in your BaseFieldDefinition for your custom entity, with this you will have space for 19 digits numbers, with unsigned property making this all positive numbers.