Skip to content

Instantly share code, notes, and snippets.

View AnthonyLaurent1's full-sized avatar

Anthony Laurent AnthonyLaurent1

View GitHub Profile
@AnthonyLaurent1
AnthonyLaurent1 / index.ts
Created September 19, 2022 09:31
Installation et utilisation de module (Typescript)
import { cpus } from 'os';
import chalk from "chalk";
const cpu = JSON.stringify(cpus());
console.log(chalk.red(cpu));
@AnthonyLaurent1
AnthonyLaurent1 / gist:14b5e88be7c92268af3514e3b717cb5c
Last active September 19, 2022 14:23
Installation et types basiques
// challenge.ts
interface User {
name:string;
age:number;
birthday?:string;
}
const prettyPrintWilder = (users:User[]) => {
users.map((user:User) => {
console.log(`${user.name} is ${user.age} years old`);
});
✔ Browser application bundle generation complete.
16 09 2022 11:28:40.761:WARN [karma]: No captured browser, open http://localhost:9876/
16 09 2022 11:28:40.768:INFO [karma-server]: Karma v6.4.0 server started at http://localhost:9876/
16 09 2022 11:28:40.768:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
16 09 2022 11:28:40.771:INFO [launcher]: Starting browser Chrome
16 09 2022 11:28:43.367:INFO [Chrome 104.0.5112.101 (Linux x86_64)]: Connected on socket uxTGVLQxBVEaDENtAAAB with id 29972978
LOG: [Cocktail{name: 'Mojito', price: 8, url: 'image du mojito'}, Cocktail{name: 'Cuba Libre', price: 10, url: 'image du Cuba Libre'}]
Chrome 104.0.5112.101 (Linux x86_64): Executed 3 of 5 SUCCESS (0 secs / 0.048 secs)
LOG: [Cocktail{name: 'Mojito', price: 8, url: 'image du mojito'}, Cocktail{name: 'Cuba Libre', price: 10, url:
LOG: [Cocktail{name: 'Mojito', price: 8, url: 'image du mojito'}, Cocktail{name: 'Cuba Libre', price: 10, url: 'image du Cuba Libre'}]
class Decipherer {
public static String decryption(String message) {
int key = message.length()/2;
message = message.substring(5, key + 5);
message = message.replace("@#?", " ");
message = new StringBuffer(message).reverse().toString();
return message;
}
class Sempai {
public static void main(String[] args) {
String title = "Indiana Jones and the Last Crusade";
boolean alreadySeen= true;
int date = 1989;
double rating = 8.2;
System.out.println("Nom du film en VO : " + title);
System.out.println("Déja vu ? " + alreadySeen);
System.out.println("Année de sorti en salle : " + date);
System.out.println("Note sur IMDB : " + rating + "/10");
@AnthonyLaurent1
AnthonyLaurent1 / gist:a256f040f9c49657ec38d1b2115bb1eb
Created September 7, 2022 19:21
Java 02 : De l'algorithmique au Java
class CandyCount {
public static void main(String[] args) {
double realMoney = 12.4;
double realPrice = 1.2;
int candies = 0;
if (realMoney > 0 && realPrice > 0) {
while ((realMoney - realPrice) >= 0) {
candies = candies + 1;
realMoney = realMoney - realPrice;
};
class Sempai {
public static void main(String[] args) {
// display Hello World! in the terminal
System.out.println("Notice me Senpai");
}
}
@AnthonyLaurent1
AnthonyLaurent1 / gist:6ca8bec18bd4cd8d727595ceb8bc8e7b
Created August 22, 2022 15:27
POO en Typescript 1 - Procédural vs Objet, classes, instances
class Person {
private name : string;
private age : number;
constructor(name:string, age:number) {
this.name = name;
this.age = age;
}
public tellMyName() {
class BankCustomer {
private name: string;
private pin: number;
constructor(name: string, pin: number) {
this.name = name;
this.pin = pin;
}
public getName(): string {
<?php
namespace App\Form;
use App\Entity\SearchTrip;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;