Skip to content

Instantly share code, notes, and snippets.

@Fabax
Fabax / wii.pde
Created November 22, 2012 12:03
Processing : Class Wii
/* Wii Processing class
* (cc) 2009 Douglas Edric Stanley
* l'Atelier Hypermédia
* l'École supérieure d'art d'Aix-en-Provence
* http://www.ecole-art-aix.fr/
*
* Pour utiliser cette classe il faut :
*
+ Osculator : http://www.osculator.net/
@Fabax
Fabax / searchreplacedb2.php
Created February 24, 2013 20:53
Wordpress : replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@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 / charCount.js
Created February 6, 2013 19:00
Char count
* Character Count Plugin - jQuery plugin
* Dynamic character count for text areas and input fields
* written by Alen Grakalic
* http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
void setup() {
size(500, 500);
noFill();
strokeWeight(3);
strokeJoin(BEVEL);
}
float th1, th2, r, x, y, t;
int N = 16;
@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);
@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;
}
<?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 / requete sql 1
Created August 21, 2013 16:15
Exemple de requete sql
try {
$sqlResquest = 'SELECT u1.user_id as user_id1,
u1.user_fname as user_fname1,
u1.user_lname as user_lname1,
u1.user_email as user_email1,
u1.user_duos as user_duos1,
u1.user_answers as user_answers1,
u1.user_img as user_img1,
d.duo_status as duo_status,
d.duo_id as duo_id,
float rot = 0;
void setup() {
size(400, 400);
background(100, 200, 50);
smooth();
noStroke();
}
void draw_rotating_rectangle(float x, float y, float rect_size, float r) {
translate(x, y);