Skip to content

Instantly share code, notes, and snippets.

View SandySanSan's full-sized avatar
💭
Wild Code School 2019

SandyP SandySanSan

💭
Wild Code School 2019
View GitHub Profile
https://google-gruyere.appspot.com/GRUYEREINSTANCEID/deletesnippet?index=0
@SandySanSan
SandySanSan / Counter.js
Created July 9, 2019 12:57
Hooks React
import React, { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>Le compteur est à : {count} </p>
<input type="text" value={count} />
<button onClick={() => setCount(count + 1)}>
@SandySanSan
SandySanSan / show.html
Created June 11, 2019 11:37
Local Storage
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Local Storage - Show</title>
</head>
<body>
@SandySanSan
SandySanSan / index.js
Created June 3, 2019 14:31
Fil rouge - Express
const connection = require('./config');
const express = require('express');
const app = express();
const port = 3000;
const bodyParser = require('body-parser');
// Support JSON-encoded bodies
app.use(bodyParser.json());
// Support URL-encoded bodies
app.use(bodyParser.urlencoded({
SELECT t.name, COUNT(*) AS nb_players
FROM team t
JOIN player p ON p.team_id = t.id
GROUP BY t.name
ORDER BY nb_players DESC
SELECT t.name, COUNT(*) AS nb_players
FROM team t
JOIN player p ON p.team_id = t.id
SELECT w.firstname, w.lastname, p.role, t.name
FROM wizard AS w
JOIN player AS p on p.wizard_id = w.id
JOIN team AS t on p.team_id = t.id
ORDER BY t.name, p.role, w.lastname ASC, w.firstname ASC;
SELECT w.firstname, w.lastname
FROM wizard AS w
JOIN player AS p on p.wizard_id = w.id
import React from 'react';
import MyTimer from './MyTimer';
function App() {
return (
<div>
<MyTimer />
</div>
);
}
@SandySanSan
SandySanSan / index.js
Created May 20, 2019 13:40
Méthode DELETE et suppression de données (Express)
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({
@SandySanSan
SandySanSan / index.js
Created May 20, 2019 13:11
Méthode PUT et modification de données (Express)
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({
@SandySanSan
SandySanSan / index.js
Created May 20, 2019 08:29
Méthode POST et insertion de données (avec Express)
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({