This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
sudo aptitude install memcached | |
sudo -s | |
echo ENABLE_MEMCACHED=yes > /etc/default/memcached | |
service memcached restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo aptitude install php5-memcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Cette variable contiendra l'identifiant unique de la session | |
$token_session = ''; | |
// Un cookie contenant l'identifiant de session a-t-il été déjà défini ? | |
if( !isset($_COOKIE['__token_session']) ) | |
{ | |
// Génération d'un identifiant unique s'il n'existait pas encore. | |
$token_session = uniqid('session', true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SessionMemcached | |
{ | |
// Cette variable contiendra l'instance de memcache. | |
private $memcache; | |
// Celle là contiendra l'identifiant unique de la session. | |
private $token_session; | |
// Ce tableau contiendra les données de session | |
private $donnees_session = array(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ms = new SessionMemcached($token_session); | |
$ms->ecrire('est_connecte', true); | |
// | |
// (...) | |
// | |
if( $ms->lire('est_connecte') ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Suivant l'environnement dans lequel nous nous trouvons | |
// on affichera ou non les erreurs qui se produisent. | |
switch(__ENVIRONNEMENT__) | |
{ | |
case 'dev': | |
case 'preprod': | |
error_reporting(E_ALL); | |
break; | |
case 'prod': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function convert($size) | |
{ | |
$unit=array('b','kb','mb','gb','tb','pb'); | |
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | |
} | |
echo convert(memory_get_usage()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Event.observe(window, 'load', function() { | |
var timer; | |
$('recherche').observe('keyup', function() { | |
clearInterval(timer); | |
timer = setInterval( | |
function() { | |
clearInterval(timer); | |
// Suite des opérations ici ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Définition du package CSS3 | |
*/ | |
#css3 { | |
/** | |
* Arrondir les angles de la boîte | |
* @param paramètres classiques du border-radius | |
*/ | |
.border-radius( @p ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* API "statique" minimaliste d'accès à l'API FlickR via JSONP. | |
* Elle repose sur jQuery notamment pour les requêtes Ajax. | |
* L'accès se fait par la méthode "interrogation()". | |
*/ | |
var ApiFlickr = { | |
/** | |
* URL du service d'API FlickR. | |
* @private |
OlderNewer