Skip to content

Instantly share code, notes, and snippets.

Jachim Coudenys coudenysj

Block or report user

Report or block coudenysj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coudenysj
coudenysj / stats.php
Last active Apr 23, 2019
A small script to return PHP stats in JSON format
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(),
]
],
@coudenysj
coudenysj / Vagrantfile
Last active Aug 11, 2016
Running Ansible 2.0 in a Debian Vagrant box
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
@coudenysj
coudenysj / ERD.png
Last active Aug 29, 2015
Using reStructuredText to generate an ERD
@coudenysj
coudenysj / DateTimeType.php
Last active Feb 22, 2016
Doctrine DateTimeType supporting MySQL fractional seconds
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');
@coudenysj
coudenysj / update.php
Created Mar 5, 2013
A small snippet that uses Zend\Db, but should create bind placeholder in the $query->where() instead of injecting the actual value.
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));
@coudenysj
coudenysj / config.log
Created Nov 29, 2012
brew install php54-memcached
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. ##
@coudenysj
coudenysj / DatabaseTest.php
Created Nov 21, 2012
Using multiple databases in phpunit/dbunit with composer
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'];
@coudenysj
coudenysj / config.log
Created Jun 12, 2012
brew install php53-gearman --HEAD
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. ##
You can’t perform that action at this time.