Skip to content

Instantly share code, notes, and snippets.

<?php
$req = $bdd->prepare('INSERT INTO jeux_video(nom, possesseur, console, prix, nbre_joueurs_max, commentaires)
VALUES(:nom, :possesseur, :console, :prix, :nbre_joueurs_max, :commentaires)');
$req->execute(array(     'nom' => $nom,     'possesseur' => $possesseur,     'console' => $console,     'prix' => $prix,     'nbre_joueurs_max' => $nbre_joueurs_max,     'commentaires' => $commentaires     ));   echo 'Le jeu a bien été ajouté !'; ?>
@Fabax
Fabax / echo Json
Created August 30, 2013 06:55
turn string into json p
function echoJSON($data) {
$json = json_encode($data);
echo isset($_GET['callback'])
? "{$_GET['callback']}($json)"
: $json;
}
@Fabax
Fabax / get midnight
Created August 30, 2013 06:57
return today's midnight timestamp
function getMidnight(){
$date = new DateTime();
$hours = $date->format('H');
$minutes = $date->format('i');
$seconds = $date->format('s');
$hours = ($hours*60)*60;
$minutes = $minutes*60;
$midnight = time()-($hours+$minutes+$seconds);
$midnight = $date = date('Y-m-d H-i-s', $midnight);
void setup() {
size(500, 500);
noFill();
strokeWeight(3);
strokeJoin(BEVEL);
}
float th1, th2, r, x, y, t;
int N = 16;
@Fabax
Fabax / back up android
Created October 28, 2013 17:18
back up android file data
adb backup -f ~/data.ab -noapk app.name
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
@Fabax
Fabax / mask1.pde
Created October 19, 2014 13:47
Processing : mask pgraphic
PGraphics s, m;
void setup(){
size(220,220);
// Create a cookie cutter.
// White areas are kept. Black areas are not.
m = createGraphics( width, height, P2D );
m.beginDraw();
m.background(0);
m.fill(255);
@Fabax
Fabax / centerAbsolute.css
Created November 20, 2014 10:58
center absolute div
#center{
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}