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 | |
/** | |
* Secret Santa Generator - powered by PHP Generators for the lolz. | |
*/ | |
$players = [ | |
"xx@jolicode.com", | |
"spam@jolicode.com", | |
"nop@jolicode.com", | |
"foo@jolicode.com", |
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 Answer extends BaseAnswer | |
{ | |
public function preSave($event) | |
{ | |
if ($this->getIsTrue()) | |
{ | |
$q = Doctrine_Query::create() | |
->update('Answer') |
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 | |
// Inside your action | |
$this->serializer = new \Symfony\Component\Serializer\Serializer(); | |
$this->serializer->addNormalizer(new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer()); | |
$this->serializer->setEncoder('xml', new \Symfony\Component\Serializer\Encoder\XmlEncoder()); | |
return $this->createResponse($this->serializer->encode($page, 'xml'), 200, array('Content-Type' => 'application/xml')); |
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 | |
/** | |
* Set cache_namespace_callable: [ pouet, generateShortenedCacheKey ] in your settings.yml | |
* Then the symfony cache key is shortened by MD5 | |
* | |
* @author dalexandre | |
* @see sfViewCacheManager::generateCacheKey | |
* @param sfViewCacheManager $sfViewCacheManager | |
* @return string | |
*/ |
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 | |
DATE=`date +%s` | |
FILENAME="/home/username/CamStream/$DATE.jpeg" | |
# Call the streamer | |
streamer -f jpeg -o $FILENAME | |
# Display a user notification | |
DISPLAY=:0.0 notify-send -u 'low' -i $FILENAME "Cheese!" "Stream saved!" |
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 | |
/** | |
* Run a command in background (Windows and linux \o/) | |
* | |
* @param wait wait for the command to terminate | |
* @author dalexandre | |
* @author jbenoist | |
* @since 24/02/2009 | |
* @update 19/08/2009 | |
* @param String $cmd |
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
// Stocker une valeur | |
sessionStorage.setItem('key', 'value'); | |
localStorage.setItem('key', 'value'); | |
// Récupérer une valeur | |
var item = sessionStorage.getItem('key'); | |
var item = localStorage.getItem('key'); | |
// Supprimer une valeur | |
sessionStorage.removeItem('key'); |
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
socket.on('batchmove', function(data) { | |
for (var i = 0; i < data.length; i++) { | |
socket.emit('move', {x: data[i].x, y: data[i].y, id: myId}); | |
} | |
}); |
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
socket.on('batchmove', function(data) { | |
for (var i = 0; i < data.length; i++) { | |
socket.emit('move', {x: data[i].x, y: data[i].y, id: myId}); | |
} | |
}); |
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
/** | |
* This spec run some files against JSHint | |
* | |
* Inspired by https://github.com/bkeepers/lucid/blob/master/spec/javascripts/z_jshint_spec.js | |
* @author bkeepers | |
* @author dalexandre | |
* | |
* @require JSHint, jQuery | |
*/ | |
describe('JSHint', function () |
OlderNewer