Instantly share code, notes, and snippets.

View stats.php
<?php
header('Content-Type: application/json');
echo json_encode(
[
'opcache' => opcache_get_status(),
'realpath_cache_size' => [
'configured' => ini_get('realpath_cache_size'),
'real' => realpath_cache_size(),
]
]
View Vagrantfile
Vagrant.configure(2) do |config|
config.vm.provision "shell", inline: <<-SHELL
sudo echo "deb http://httpredir.debian.org/debian jessie-backports main contrib non-free" > /etc/apt/sources.list.d/jessie-backports.list
sudo apt-get update
sudo apt-get -t jessie-backports install ansible -y
ansible-playbook /vagrant/playbook.yml
SHELL
end
View DateTimeType.php
<?php
/**
* A custom type type for datetime(3) in MySQL.
*
* @see http://www.doctrine-project.org/jira/browse/DBAL-1084
*/
namespace My\Project\DBAL\Types;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
View print-dispatcher.php
<?php
/**
* Create a PULL socket to receive print requests from the webserver.
* Create a PUB socket to send print requests to the windows laptop.
*/
$context = new ZMQContext();
$pub = $context->getSocket(ZMQ::SOCKET_PUB);
$pub->bind('tcp://*:5566');
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://*:5567');
View update.php
<?php
$sql = new \Zend\Db\Sql\Sql($db, 'user');
$query = $sql->update();
$query->set(array('_update' => date('Y-m-d H:i:s')));
$query->where(array('userID' => 1));
$stmt = $sql->prepareStatementForSqlObject($query);
$stmt->execute(array('userID' => 1));
View config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/php54-memcached/2.0.1 --with-php-config=/usr/local/Cellar/php54/5.4.9/bin/php-config --with-libmemcached-dir=/usr/local/Cellar/libmemcached/1.0.14
## --------- ##
## Platform. ##
View DatabaseTest.php
/**
* Specific example for Zend Framework 1.0 applications (update the database "fetching")
*/
class DatabaseTest extends PHPUnit_Extensions_MultipleDatabase_TestCase
{
protected function getDatabaseConfigs()
{
$configs = array();
$options = $this->_application->getOptions();
$databases = $options['resources']['dbs'];
View config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/php53-gearman/HEAD --with-gearman=/usr/local/Cellar/gearman/0.33
## --------- ##
## Platform. ##