Skip to content

Instantly share code, notes, and snippets.

interface User {
name: string,
age: number
}
type ppw = (users: User[]) => void
const prettyPrintWilder: ppw = (users) => {
users.map((user) => {
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
arr.length < 1
? "<div class=d-flex> <img src=IMAGE_NIVEAU_1> </div>"
: arr.length > 1 && arr.length <= 10
? "<div class=d-flex> <img src=IMAGE_NIVEAU_1><img src=IMAGE_NIVEAU_2> </div>"
: arr.length > 10 && arr.length <= 20
? "<div class=d-flex> <img src=IMAGE_NIVEAU_1><img src=IMAGE_NIVEAU_2><img src=IMAGE_NIVEAU_3> </div>"
: arr.length > 20
? "<div class=d-flex> <img src=IMAGE_NIVEAU_1><img src=IMAGE_NIVEAU_2><img src=IMAGE_NIVEAU_3><img src=IMAGE_NIVEAU_4> </div>"
@bapHyv
bapHyv / index.js
Created May 21, 2019 10:05
EXPRESS 5 - Méthode DELETE et suppression de données
const express = require('express');
const app = express();
const connection = require('./conf');
const port = 3021;
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
extended: true
})
@bapHyv
bapHyv / index.js
Created May 21, 2019 09:49
EXPRESS 4 - Méthode PUT et modification de données
const express = require('express');
const app = express();
const connection = require('./conf');
const port = 3019;
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
extended: true
})
const express = require('express');
const app = express();
const connection = require('./conf');
const port = 3016;
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
extended: true
})
mysql> select count(*) as nb_player, team.name from player inner join team on team.id=player.team_id group by team_id order by nb_player desc;
+-----------+------------+
| nb_player | name |
+-----------+------------+
| 36 | Gryffindor |
| 21 | Slytherin |
| 15 | Ravenclaw |
| 12 | Hufflepuff |
+-----------+------------+
4 rows in set (0.01 sec)
SELECT firstname, lastname, role, name FROM player JOIN wizard ON wizard.id=player.wizard_id JOIN team ON team.id=player.team_id ORDER BY name ASC, role ASC, lastname ASC, firstname ASC;
+-------------+-----------------+--------+------------+
| firstname | lastname | role | name |
+-------------+-----------------+--------+------------+
| Sirius | Black | beater | Gryffindor |
| Lavender | Brown | beater | Gryffindor |
| Seamus | Finnigan | beater | Gryffindor |
| Rubeus | Hagrid | beater | Gryffindor |
| Alice | Longbottom | beater | Gryffindor |
| Minerva | McGonagall | beater | Gryffindor |
@bapHyv
bapHyv / index.js
Last active May 17, 2019 09:10
quest_Express2_Express_Mysql_Postman
const express = require('express');
const app = express();
const connection = require('./conf');
const port = 3005;
app.get('/', (request, response) => {
response.send('Bienvenue sur Express');
});
app.get('/api/movies', (req, res) => {
import React, { Component } from 'react';
import Card from './components/Card/Card.jsx';
import { Button, CardImg, Jumbotron, Container } from 'reactstrap';
import { NavLink } from 'react-router-dom';
import AlgoCombat from './AlgoCombat';
import Select from './select.png';
import Superheroes from './Superheroes.jpg';
class SelectHero extends Component {
constructor(props) {
.App {
text-align: center;
}
.cardDisplay {
display: flex;
flex-direction: row;
justify-content: space-around;
}
.buttonDisplay {