Drupal 8 - Get fields from a node

I am currently using Drupal 8 - Beta 2. I took a little while to understand that nodes and users are part of the new entity architecture and all the node_WHATEVER functions used in Drupal 7 have completelly desapeared. This is a function that returns an array of node fields (type slider). I find this piece of code really helpfull to developers. I hope it save the 2 hours I took to figure this out.

 

function _frf_blocks_get_slider_nodes() {
  $node_type = 'slider'; // this is name of slider type content.
  $data = array();
  $nids = db_query("SELECT n.nid FROM {node} n WHERE n.type = :type ORDER BY n.nid DESC", array(':type' => $node_type))->fetchCol();
  if (!empty($nids)) {
    $nodes = entity_load_multiple('node', $nids);
    foreach($nodes as $key => $node) {
      foreach ($node->getFields() as $name => $fields) {
        foreach ($fields as $langcode => $field) {
          $data[$key][$name] = $field->getValue();
        }
      }
    }
  }
  return $data;
}