This file contains hidden or 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
var spawn = require('child_process').spawn, | |
grep = spawn('grep', ['-v Foo', 'file.txt']); | |
grep.stdout.on('data', function (data) { | |
console.log('stdout: ' + data); | |
}); | |
grep.stderr.on('data', function (data) { | |
console.log('stderr: ' + data); | |
}); |
This file contains hidden or 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
var_dump (null === true ? "oui" : "non"); |
This file contains hidden or 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
vim /etc/init.d/firewall | |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: firewall | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
This file contains hidden or 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
L'inaptocratie. | |
La démocratie Française redéfinie en "inaptocratie" par un scientifique anglais. | |
Inaptocratie : un système de gouvernement où les moins capables de gouverner sont élus par les moins capables de produire et où les autres membres de la société les moins aptes à subvenir à eux-mêmes ou à réussir, sont récompensés par des biens et des services qui ont été payés par la confiscation de la richesse et du travail d'un nombre de producteurs en diminution continuelle. |
This file contains hidden or 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 | |
sscanf('foo/bar', '%s/%s', $foo, $bar); | |
var_dump($foo); //string(7) "foo/bar" | |
var_dump($bar); //NULL | |
?> |
This file contains hidden or 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 | |
require 'vendor/autoload.php'; | |
ini_set('memory_limit', '500M'); | |
use Symfony\Component\Finder\Finder; | |
$finder = new Finder(); | |
$finder->files() | |
->in(__DIR__ . "/../") |
This file contains hidden or 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 | |
//get user | |
$friends = $user->getFriends(); | |
foreach ($friends as $friend) { | |
echo $friend->getId(); | |
} |
This file contains hidden or 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
$user = $em->find('Entities\User', $id); | |
$messages = $user->getPrivateMessages(); | |
foreach($messages as $message) { | |
$responses = $message->getResponseMessages(); | |
} |
This file contains hidden or 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
$user = $em->find("Entities\User", $idUser); | |
$query = $em->createQuery('SELECT messages, responses FROM Entities\Message messages JOIN messages.responses JOIN messages.user user WHERE user.id = :id_user); | |
$query->setParameter("id_user", $user->getId()); | |
$messages = $query->getResult(); | |
foreach ($messages as $message) { | |
$responses = $message->getResponses(); //Entities\Message |
This file contains hidden or 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 TextBuilder { | |
private $template; | |
private $parameters; | |
public function __construct($template = null, array $parameters = null) { | |
$this->template = $template; | |
$this->parameters = $parameters ? $parameters : array(); | |
} |