This file contains hidden or 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 assert from 'assert'; | |
| class BankCustomer { | |
| private name: string; | |
| private pin: string; | |
| constructor(name: string, pin: string) { | |
| this.name = name; | |
| this.pin = pin; |
This file contains hidden or 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
| class Person { | |
| name: string; | |
| age: number; | |
| constructor(name: string, age: number) { | |
| this.name = name; | |
| this.age = age; | |
| } | |
| tellMyName() { | |
| console.log(`I am ${this.name}`); | |
| } |
This file contains hidden or 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 { cpus } from 'os'; | |
| import chalk from 'chalk'; | |
| const cpusString = JSON.stringify(cpus()); | |
| const redCpusString = chalk.red(cpusString); | |
| console.log(redCpusString); |
This file contains hidden or 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
| // challenge.ts | |
| interface User { | |
| name: string; | |
| age: number; | |
| birthday?: string; | |
| } | |
| const prettyPrintWilder = (users: User[]): void => { | |
| users.map((user) => { | |
| console.log(`${user.name} is ${user.age} years old`); | |
| }); |
This file contains hidden or 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
| function hello(name: string) { | |
| console.log("Hello " + name); | |
| } | |
| const firstName = "bob"; | |
| hello(firstName); | |
| hello(firstName + " marley"); | |
| function concat(a: string, b: string) { | |
| return a + b; |
This file contains hidden or 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
| Trouve l'expression régulière qui cherche la seule occurrence du deuxième prénom de Néo (soit le A. de "Thomas A. Anderson). | |
| /A\./g | |
| Trouve l'expression régulière qui cherche la date contenue dans le document. | |
| /\d{2}\/\d{2}\/\d{4}/g | |
| Trouve l'expression qui cherche la note contenue dans le texte, sans pour autant sélectionner une partie de la date (tu peux t'aider du caractère espace avant la note). | |
| /\s\d{1}\/\d{2}/g | |
| Trouve l'expression régulière qui renvoie les mots ayant au moins 14 caractères (tu devrais trouver l'age du capitaine, à moins que ça ne soit son vaisseau !) |
This file contains hidden or 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 request = require('request'); | |
| request('https://swapi.dev/api/people/1/', function (error, response, body) { | |
| // console.error('error:', error); // Print the error if one occurred | |
| // console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received | |
| // console.log('body:', body); // Print the body | |
| let luke = JSON.parse(body); | |
| console.log(luke); | |
| console.log(luke.films); | |
| request('http://swapi.dev/api/films/1/', function (errorF, responseF, bodyF) { | |
| let film = JSON.parse(bodyF); |
This file contains hidden or 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 connection = require('./db-config'); | |
| connection.connect(function (err) { | |
| if (err) { | |
| console.error('error connecting: ' + err.stack); | |
| return; | |
| } | |
| console.log('connected as id ' + connection.threadId); | |
| }); |
This file contains hidden or 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 connection = require('./db-config'); | |
| connection.connect(function (err) { | |
| if (err) { | |
| console.error('error connecting: ' + err.stack); | |
| return; | |
| } | |
| console.log('connected as id ' + connection.threadId); | |
| }); |
This file contains hidden or 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_2 | |
| Database changed | |
| mysql> SELECT name AS teamname, COUNT(name) as num_players | |
| -> FROM wizard | |
| -> JOIN player ON player.wizard_id = wizard.id | |
| -> JOIN team ON player.team_id = team.id | |
| -> GROUP BY name | |
| -> ORDER BY num_players DESC; | |
| +------------+-------------+ | |
| | teamname | num_players | |
NewerOlder