<commit_before># Live Timeline

**A Facebook-like timeline**

This tutorial will guide you through the development of the app.

We will be introducing new concepts on each step, so make sure you understand what's going on before going further!
If you have any doubts, please ask your coach for help.

## Setup your Firebase
You need to create a new app on [Firebase](https://www.firebase.com/) (the Free Plan is enough) and you need to configure it.
### Firebase rules

```
{
 "rules": {
  ".read": true,
  ".write": true,
  "posts": {
    "$post": {
    ".validate": "newData.hasChildren(['title', 'body']) && newData.child('title').isString() && newData.child('body').isString() && newData.child('title').val().length > 1 && newData.child('body').val().length > 1",
    ".read": true,
    ".write": true
    }
  }
 }
}
```

## Key concepts

During the workshop we will be covering the following concepts:

### JavaScript
  * Base values: `String`, `Number`, `Boolean`, undefined values
  * Variables and functions
  * Compound values: `Array` and `Object`
  * Language Structure: `if`, `return`
  * Global methods: `setInterval`
  * Array methods: `forEach`
  * HTTP-related methods: `fetch`

### The DOM
  * `Element` and some of its properties and methods (`querySelector`, `innerHTML`)
  * The events and the event object main properties (`target`, `preventDefault`)

### The Web
Internet, at its core, works in a very simple way.

You **request** for something (eg. a web page such as `www.google.com`) and at some point you get back a **response**. Yes, it's just **that** simple!

This **request–response** mechanism happens for example when entering a website address in the address bar of your browser.
So it turns out browsers can help us making requests and handling responses.

Going a level deeper we find out that this is because they're good at handling the communication protocol the *World Wide Web* is built on: [Http](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol).

So when working on our web applications, everytime we want to communicate with the outside world, we can rely on our the capability of our browsers to handle a **HTTP request** and work on the *response* we get back.

**HTTP request** define a few *methods* to better specify the type of request you want to create. We won't go too much into details here, but it's useful that you learn at least the two most common methods one can use: **GET** and **POST**.

  * The **GET** method is usually used when you want to retrieve some remote resource
  * In contrast, the **POST** method is used when you want to send over something over to some remote entity

We can then use our browsers' capability of handling the HTTP protocol in our JavaScript applications.

More specifically the api we will be using go by the name of [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).

**fetch** is an easy api. You can:
  * create your request for your remote resource just like this: `fetch(MY_REMOTE_RESOURCE)`
  * you can then work on the response by defining the usual so-called *callback* function. It'll look like this:
  ```javascript
  fetch('flowers.jpg')
    .then(function(response) {
      // do something with your response object
    })  
  ```
<commit_msg>minor.<commit_after># Live Timeline

**A Facebook-like timeline**

This tutorial will guide you through the development of the app.

We will be introducing new concepts on each step, so make sure you understand what's going on before going further!
If you have any doubts, please ask your coach for help.

## Setup your Firebase
You need to create a new app on [Firebase](https://www.firebase.com/) (the Free Plan is enough) and you need to configure it.
Here a configuration example:

```
// TODO
```

## Key concepts

During the workshop we will be covering the following concepts:

### JavaScript
  * Base values: `String`, `Number`, `Boolean`, undefined values
  * Variables and functions
  * Compound values: `Array` and `Object`
  * Language Structure: `if`, `return`
  * Global methods: `setInterval`
  * Array methods: `forEach`
  * HTTP-related methods: `fetch`

### The DOM
  * `Element` and some of its properties and methods (`querySelector`, `innerHTML`)
  * The events and the event object main properties (`target`, `preventDefault`)

### The Web
Internet, at its core, works in a very simple way.

You **request** for something (eg. a web page such as `www.google.com`) and at some point you get back a **response**. Yes, it's just **that** simple!

This **request–response** mechanism happens for example when entering a website address in the address bar of your browser.
So it turns out browsers can help us making requests and handling responses.

Going a level deeper we find out that this is because they're good at handling the communication protocol the *World Wide Web* is built on: [Http](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol).

So when working on our web applications, everytime we want to communicate with the outside world, we can rely on our the capability of our browsers to handle a **HTTP request** and work on the *response* we get back.

**HTTP request** define a few *methods* to better specify the type of request you want to create. We won't go too much into details here, but it's useful that you learn at least the two most common methods one can use: **GET** and **POST**.

  * The **GET** method is usually used when you want to retrieve some remote resource
  * In contrast, the **POST** method is used when you want to send over something over to some remote entity

We can then use our browsers' capability of handling the HTTP protocol in our JavaScript applications.

More specifically the api we will be using go by the name of [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).

**fetch** is an easy api. You can:
  * create your request for your remote resource just like this: `fetch(MY_REMOTE_RESOURCE)`
  * you can then work on the response by defining the usual so-called *callback* function and giving it to the `then` method

It'll look like this:
```javascript
fetch('http://some_remote_url')
  .then(function(response) {
    // do something with your response object
  })  
```

{'fraction_non_alphanumeric': 0.0972644376899696, 'fraction_numerical': 0.00031994880819068947, 'mean_word_length': 4.205661948376353, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1841815', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1623, 'n_words': 872}