Skip to content

Instantly share code, notes, and snippets.

View clarade's full-sized avatar
:shipit:
Creatin some stuff

Clara Desp clarade

:shipit:
Creatin some stuff
View GitHub Profile
@clarade
clarade / challenge.ts
Last active September 20, 2021 19:37
Small exercise about ts basics and types
// Declare an User interface with typed properties
interface User {
name: string;
age: number;
[key: string]: any;
}
// Declare types for the parameter, and for the function return prettyPrintWilder
const prettyPrintWilder = (users: User[]) => {
users.map((user: User) => {
-- MySQL dump 10.13 Distrib 5.7.21, for Linux (x86_64)
--
-- Host: localhost Database: bdd_advanced
-- ------------------------------------------------------
-- Server version 5.7.21-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@clarade
clarade / HighWay.php
Created March 24, 2021 21:58
Exercise about abstract and final classes in OOP
<?php
abstract class HighWay
{
protected array $currentVehicles;
protected int $nbLane;
protected int $maxSpeed;
@clarade
clarade / Advanced-sql.sql
Created March 24, 2021 21:51
Exercise about sql advanced basics
mysql> SELECT team.name, COUNT(*) AS nb_student
-> FROM team JOIN player ON team.id=player.team_id
-> GROUP BY team_id
-> ORDER BY nb_student DESC;
+------------+------------+
| name | nb_student |
+------------+------------+
| Gryffindor | 36 |
| Slytherin | 21 |
| Ravenclaw | 15 |
@clarade
clarade / wild_db_quest.sql
Created March 23, 2021 22:38
Exercise about sql joints
mysql> SELECT wizard.firstname, wizard.lastname, player.role, team.name
-> FROM wizard JOIN player ON wizard.id=player.wizard_id
-> JOIN team ON team.id=player.team_id
-> ORDER BY team.name ASC, player.role, lastname, firstname;
+-------------+-----------------+--------+------------+
| firstname | lastname | role | name |
+-------------+-----------------+--------+------------+
| Sirius | Black | beater | Gryffindor |
| Lavender | Brown | beater | Gryffindor |
| Seamus | Finnigan | beater | Gryffindor |
@clarade
clarade / index.php
Created March 22, 2021 09:56
ODP exercises
<?php
require 'php-connec.php';
$pdo = new \PDO(DSN, USER, PASS);
$query = "SELECT * FROM friend";
$statement = $pdo->query($query);
$friends = $statement->fetchAll();
?>
@clarade
clarade / Bicycle.php
Created March 21, 2021 14:02
Exercise about POO heritage and parents composants
<?php
require_once 'Vehicle.php';
class Bicycle extends Vehicle
{
public function __construct(string $color, int $nbSeats, string $energy)
{
parent::__construct($color, $nbSeats);
$this->energy = $energy;
@clarade
clarade / Bicycle.php
Created March 18, 2021 22:03
POO exercise about classes
<?php
class Bicycle
{
private $color;
private $currentSpeed;
private $name;
@clarade
clarade / Fighter.php
Created March 17, 2021 22:25
Exercise about POO
<?php
class Fighter
{
const MAX_LIFE = 100;
private $name;
private $life = self :: MAX_LIFE;
@clarade
clarade / form.html
Last active March 12, 2021 19:42
Exercise about advanced PHP with forms
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
<title>Form</title>
</head>