This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AbstractControl, ValidationErrors } from '@angular/forms'; | |
export function emailValidator(control: AbstractControl): ValidationErrors | null { | |
// One uppercase at least | |
const emailRegex = RegExp('^[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\\.[a-z]{2,3}$'); | |
const valid = emailRegex.test(control.value); | |
const errors = { | |
email: { | |
rules: 'should be a valid email adress' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form [formGroup]= "userForm"(ngSubmit)="onSubmit()"> | |
<div formGroupName="address"> | |
<div> | |
<label> | |
Street: | |
<input type="text" formControlName="street"> | |
</label> | |
</div> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
app.get('/api/movie', (req, res) => { | |
// connection to the database, and selection of employees | |
connection.query('SELECT * from movie', (err, results) => { | |
console.log(err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
const bodyParser = require('body-parser'); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use(bodyParser.urlencoded({ | |
extended: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
const bodyParser = require('body-parser'); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use(bodyParser.urlencoded({ | |
extended: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET https://api.ipify.org/ | |
### GET Image construction | |
GET https://upload.wikimedia.org/wikipedia/commons/2/20/UnderCon_icon.svg | |
### GET Tim Berner Lee | |
GET https://www.w3.org/History/19921103-hypertext/hypertext/WWW/TheProject.html | |
### GET Heroes | |
GET https://http-practice.herokuapp.com/status | |
### GET application statis in JSON format | |
GET https://http-practice.herokuapp.com/status | |
Accept: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
app.get("/api/movies", (req, res) => { | |
res.send("Récupère tout les films"); | |
}); | |
app.get("/api/movies/:id", (req, res) => { | |
res.json({ id: req.params.id }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SELECT * FROM school; | |
Empty set (0,00 sec) | |
mysql> INSERT INTO school (name, country, capacity) VALUES ('Beauxbatons Academy of Magic', 'France', 550) , ('Castelobruxo ', 'Brazil', 380), ('Durmstrang Institute', 'Norway', 570), ('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 450), ('Ilvermorny School of Witchcraft and Wizardry', 'USA', 300), ('Koldovstoretz', 'Russia', 125), ('Mahoutokoro School of Magic', 'Japan', 800), ('Uagadou School of Magic', 'Uganda', 350); | |
Query OK, 8 rows affected (0,02 sec) | |
Records: 8 Duplicates: 0 Warnings: 0 | |
mysql> SELECT * FROM school; +----+----------------------------------------------+----------+----------------+ | |
| id | name | capacity | country | | |
+----+----------------------------------------------+----------+----------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> USE wild_db_quest; | |
Reading table information for completion of table and column names | |
You can turn off this feature to get a quicker startup with -A | |
Database changed | |
mysql> SELECT firstname,lastname,birthday,birth_place,biography,is_muggle FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31'; | |
+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| firstname | lastname | birthday | birth_place | biography | is_muggle | | |
+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| harry | potter | 1980-07-31 | london | | 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cowsay = require("cowsay"); | |
console.log(cowsay.say({ | |
text : "Hello boy", | |
e : "oO", | |
T : "U " | |
})); | |
// or cowsay.think() |
NewerOlder