- Singleton : Garantit qu'une classe n'a qu'une seule instance et fournit un point d'accès global à cette instance.
- Factory Method : Définit une interface pour créer un objet, mais permet aux sous-classes de choisir la classe d'objet à instancier.
- Abstract Factory : Fournit une interface pour créer des familles d'objets connexes sans spécifier leurs classes concrètes.
- Builder : Sépare la construction d'un objet complexe de sa représentation afin que le même processus de construction puisse créer différentes représentations.
- Prototype : Utilisé pour créer de nouveaux objets en copiant un prototype existant plutôt qu'en utilisant un constructeur.
- Object Pool : Un ensemble d'objets pré-construits qui sont maintenus prêts à être utilisés, évitant ainsi le coût de création et de destruction d'objets fréquemment utilisés.
This file contains 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 pygame | |
# Set up the screen dimensions | |
screen_width = 640 | |
screen_height = 480 | |
screen = pygame.display.set_mode((screen_width, screen_height)) | |
# Set up the title of the window | |
pygame.display.set_caption('Bomberman') |
This file contains 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
use std::fmt; | |
use std::time::Duration; | |
fn main() { | |
// Set up the game board | |
let mut board = vec![]; | |
for _ in 0..10 { | |
board.push(vec![0; 10]); | |
} |
This file contains 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 Game { | |
private gameBoard: number[] = []; // 3x3 grid of squares | |
private playerPieces: string[] = ['X', 'O']; // array of player pieces (X or O) | |
private winningConditions: string[] = ['horizontally', 'vertically', 'diagonally']; // array of winning conditions | |
constructor() { | |
this.resetGame(); | |
} | |
resetGame(): void { |
This file contains 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
version: "3" | |
services: | |
wireguard: | |
image: linuxserver/wireguard:latest | |
container_name: wireguard | |
cap_add: | |
- NET_ADMIN | |
sysctls: | |
- net.ipv4.conf.all.src_valid_mark=1 |
This file contains 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 pairSumExplain = (array: Array<number>, target: number): Array<Array<number>> => { | |
const length: number = array.length; | |
const found: Array<Array<number>> = []; | |
for(let i = 0; i < length; i++) { | |
for(let j = (i + 1); j < length; j++) { | |
if(target == array[i] + array[j]) found.push([array[i], array[j]]); | |
} | |
} |
This file contains 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
#!/bin/sh -e | |
cat <<EOF | |
__ ________ .___ | |
| | __\_____ \ __| _/ | |
| |/ / _(__ < / __ | | |
| < / \/ /_/ | | |
|__|_ \/______ /\____ | | |
\/ \/ \/ |
You're contributor, here are the guidelines we would must follow:
- We've very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate change log. We use Conventional Commits guideline. It's better to create branches and commit messages in English and make them understandable
- I.N.V.E.S.T.(Independent, Negotiable, Valuable, Estimatable, Small, Testable) ! Each Stories are a widely accepted set of criteria, or checklist, to assess the quality. If stories fails to meet one of these criteria, the team may want to reword it, or even consider a rewrite.
- DRY ! It's better whenever possible, re-using as much code as possible rather than duplicating similar
This file contains 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 React, { Fragment } from 'react'; | |
import PropTypes from 'prop-types'; | |
const TextWithCR = ({ text }) => { | |
const lines = text.split('\n'); | |
return ( | |
<Fragment> | |
{lines.map(line => ( | |
<Fragment key={line}> |
This file contains 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 { useState, useEffect } from 'react'; | |
const render = data => match => | |
data.pending ? match.pending() | |
: data.error ? match.error(data.error) | |
: data.data ? match.data(data.data) | |
: null; | |
export const useStateFetch = url => { | |
const [data, setData] = useState({ pending: true }); |
NewerOlder