Skip to content

Instantly share code, notes, and snippets.

View dwaps's full-sized avatar

Cornillon Michael dwaps

View GitHub Profile
@dwaps
dwaps / data.json
Last active January 4, 2024 12:14
learn-english-app json for tests
{
"grammar": [],
"vocabulary": {
"categories": ["family","flowers","colors","numbers"],
"words": [
{
"mother": {
"id": "573d4c6d-13dd-4037-9528-808a850bc75e",
"category": 0,
"french": "mère",
@dwaps
dwaps / top-headlines?category=business
Last active March 16, 2022 19:22
TP Ionic - News Top Headlines (page1)
{
"status": "ok",
"totalResults": 70,
"articles": [
{
"source": {
"id": "google-news",
"name": "Google News"
},
"author": null,
@dwaps
dwaps / content-example.png
Last active May 15, 2020 12:52
For README.md of package Writerm in npmjs.com
content-example.png
@dwaps
dwaps / logger.js
Created April 29, 2020 05:00
JS: TP création d'une classe pour afficher de simples logs stylisés.
/**
* Override of console.log: just another way to display log with style.
*
* @author Michael CORNILLON <ei.dwaps@gmail.com>
* @version 1.0
*/
export default class Logger {
/**
* Initilize properties for log message and its style(s)
@dwaps
dwaps / index.html
Created December 9, 2019 15:33
NODE: Exercice routing simple 2
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>TITLE</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
@dwaps
dwaps / server.js
Created December 9, 2019 15:31
NODE: Exercice routing simple 1
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>TITLE</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
@dwaps
dwaps / README.md
Created December 8, 2019 11:20
NODE.JS: Exercice insertion de code à partir de fichier.

INSERTION DYNAMIQUE DE CODE DANS UN FICHIER

INSTALLATION

L'index.html et l'index.js doivent se trouver à la racine du projet.

Ensuite:

  • Les feuilles de styles à la racine du dossier css/
  • Les scripts à la racine du dossier js/
  • Les fragments de code html à la racine du dossier html/
@dwaps
dwaps / geolocation.js
Created December 7, 2019 08:43
HTML5 API: Geolocation --> getCurrentPosition()
if ('geolocation' in navigator) {
const { geolocation } = navigator;
geolocation.getCurrentPosition(success, error);
function success(position) {
const { coords } = position;
const p = document.querySelector('p');
p.innerHTML = `
<strong>LAT:</strong> ${coords.latitude}<br>
<strong>LNG:</strong> ${coords.longitude}
@dwaps
dwaps / index.js
Created December 6, 2019 11:41
ES6: Notion de promesse.
// Model
class User {
constructor(name, role) {
this.name = name;
this.role = role;
}
}
// BDD
const users = [
@dwaps
dwaps / index.js
Created December 5, 2019 15:56
ES6: Exemple de génération de todo en HTML
// CLASSE
class Todo {
constructor(text) {
this.text = text;
this.done = false;
}
}
// RECUP DES TODOS
const todos = [