Skip to content

Instantly share code, notes, and snippets.

View sbstp's full-sized avatar

Simon Bernier St-Pierre sbstp

View GitHub Profile
int sommets = rand(8, 12);
int arretes = rand(sommets, 2 * (fact(sommets) / (fact(2) * fact(sommets - 2))));
GrapheOriente go = new GrapheOriente(sommets);
for (int i = 0; i < arretes; i++) {
int sommet1;
int sommet2;
do {
sommet1 = rand(1, sommets);
sommet2 = rand(1, sommets);
public boolean circuitExiste(int sommet) {
if (adjacents[sommet - 1][sommet - 1] == 1) return true; // boucle sur le même sommet
int exposant = 1;
int[][] matExp = matriceAdjacence();
while (exposant <= adjacents.length && matExp[sommet - 1][sommet - 1] == 0) {
exposant++;
matExp = produitMatrice(adjacents, matExp);
}
public int longueurChemin(int sommet1, int sommet2) {
int exposant = 1;
int[][] matExp = matriceAdjacence();
while (exposant < adjacents.length && matExp[sommet1 - 1][sommet2 - 1] == 0) {
exposant++;
matExp = produitMatrice(adjacents, matExp);
}
return exposant == adjacents.length ? 0 : exposant;
File films = new File("x:/films");
File dir;
for (File fic : films.listFiles()) {
if (fic.isFile()) {
dir = new File(films, fic.getName().substring(0, fic.getName().lastIndexOf(".")));
dir.mkdir();
fic.renameTo(new File(dir, fic.getName()));
}
}
use immeuble
Begin tran
select * from locataire
delete from locataire
where no_appart in (
select no_appart from appart_extra
where no_extra = 8)
select * from locataire
<?php
// prende la valeur envoyé par le code javascript
$text = $_GET['text'];
<!DOCTYPE html>
<html>
<head>
<title>Ajax / Exemple 1</title>
<meta charset="UTF-8">
02/12 [Soutien] examen 2 partie 1
02/12 [Android] tp3
04/12 [ASP] tp6
05/12 [ASP] examen 2
06/12 [Admin] examen 3
09/12 [Soutien] examen 2 partie 2
09/12 [Soutien] tp2 partie 3 avant 18h
09/12 [Android] examen 2
11/12 [ASP] tp7
12/12 [ASP] examen 3
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'node-test',
password : '',
database : 'node_test'
});
exports.open = function (callback){
connection.connect(function(err){
@sbstp
sbstp / money_splitter.coffee
Last active August 29, 2015 13:55
Determines who should give how much to who, accounting for each person's input
displayNum = (num) ->
return '' + Math.round(num * 100) / 100
class Person
constructor: (@name, @input) ->
@balance = 0
give: (other, amount) ->
@balance -= amount