Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre Cibot Alexandre-cibot

View GitHub Profile
View crack-caesar-code.js
// Crack caesard encoded sentences.
// By find which letter is E.
// E is letter the most used in french.
function crack(caesarCode) {
const matrix = {};
const caesarCodeArray = caesarCode.toUpperCase().split('')
caesarCodeArray.filter(e => e !== " ").forEach(e => {
if(matrix[e]) {
matrix[e] += 1
} else {
@Alexandre-cibot
Alexandre-cibot / cipher.js
Created Feb 19, 2021
Vigenère cipher - Clash of Code
View cipher.js
// Vigenère cipher
// https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
// Created for a Clash Of Code
// doesnt respect case. screw it.
function encrypt(text, code) {
text = text.toLowerCase();
code = code.toLowerCase();
const alpha = [..."abcdefghijklmnopqrstuvwxyz".repeat(2)];
let output = "";
let key = code;
View app.js
// Initialize variables
const FIRST_PLAYER = 'x'
const SECOND_PLAYER = 'o'
let currentPlayer = FIRST_PLAYER
let running = true
let grid = []
startGame()
function startGame() {
running = true
@Alexandre-cibot
Alexandre-cibot / settings.json
Last active Apr 29, 2021
VsCode preferences (06/2020)
View settings.json
{
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
},
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
View arrayNb.js
class ArrayNb extends Array {
constructor(props) {
!!props ? super(props) : super();
}
push(...elements) {
if ( [...elements].every(e => typeof e === "number") ){
return super.push(...elements);
} else {
throw new Error("ArrayNb can only store numbers");
}
View bubbleSort.js
function bubbleSort(array) {
let res = [...array];
let status = new Array(res.length - 2).fill(false);
while (!status.every(e => e === true)) {
for (let i = 0; i < res.length - 1; i++) {
if (res[i] > res[i + 1]) {
// swap values
let temp = res[i];
res[i] = res[i + 1];
res[i + 1] = temp;
View vscode-settings.json
// Placez vos paramètres dans ce fichier pour remplacer les paramètres par défaut
{
// Use ZSH as the integrated terminal shell
"terminal.integrated.shell.osx": "zsh",
"workbench.colorTheme": "Atom One Dark",
"editor.tabSize": 2,
"window.zoomLevel": 1,
// "sublimeTextKeymap.promptV3Features": true,
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,