Skip to content

Instantly share code, notes, and snippets.

@palra
palra / machine.js
Created November 17, 2020 15:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@palra
palra / machine.js
Last active February 4, 2020 13:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@palra
palra / Dictionnary.java
Created December 16, 2017 17:08
SDD - Java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Dictionnary {
private final Node root;
public Dictionnary() {
this.root = new Node('\0');
}
@palra
palra / Dict.cpp
Created December 7, 2017 11:24
SDD - C++
//
// Created by LPL3 on 05/12/2017.
//
#include "Dict.h"
#include <iostream>
Dict::Dict() {
root = std::make_shared<Node>('\0');
}
@palra
palra / Hanoi.hpp
Last active November 5, 2017 20:01
Hanoï
#pragma once
#include <ostream>
#include "Stack.hpp"
/**
* Représente un jeu de tour de Hanoï, avec trois piles.
* Encapsule trois piles d'entiers. Chaque entier représente un disque, et la
* valeur de l'entier sa taille.
*/
class Hanoi {
@palra
palra / flemme.js
Last active October 6, 2017 13:01
function mod(n, m) {
return ((n % m) + m) % m;
}
function Time(hours, minutes, seconds) {
this.seconds = mod((seconds || 0), 60);
this.minutes = ~~(seconds/60);
this.minutes += mod((minutes || 0), 60);
this.hours = ~~(minutes/60);
this.hours += mod((hours || 0), 60);
#include <stdio.h>
#include <stdlib.h>
typedef struct t_node {
int data;
struct t_node *next; // Pointe vers l'élément suivant, NULL si il n'y en a pas
} t_node;
typedef struct t_queue {
t_node *first; // Pointe vers le 1er élément de la liste
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct t_queue {
int *tab;
int size;
} t_queue;
#include <stdio.h>
#include <stdlib.h>
#define T_MAX 50
typedef struct t_queue {
int tab[T_MAX];
int front, rear;
int size;
} t_queue;