Skip to content

Instantly share code, notes, and snippets.

View emodric's full-sized avatar
🇭🇷
Adventure, excitement... A Jedi craves not these things!

Edi Modrić emodric

🇭🇷
Adventure, excitement... A Jedi craves not these things!
View GitHub Profile
@emodric
emodric / DefaultApplyingNodeVisitor.php
Last active April 20, 2017 12:25
JMS Translation Bundle Twig 2
<?php
...
$transchoiceNode = new Node\Transchoice($transchoiceArguments, $transNode->getTemplateLine());
$node->setNode('node', $transchoiceNode);
...
@emodric
emodric / gist:51504521bba888c9e012
Created December 16, 2015 13:37
eZ Publish legacy clone, composer install & autoload generate
eddie@abyss [~] $ git clone git@github.com:ezsystems/ezpublish-legacy.git
Cloning into 'ezpublish-legacy'...
remote: Counting objects: 368949, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 368949 (delta 0), reused 0 (delta 0), pack-reused 368944
Receiving objects: 100% (368949/368949), 207.06 MiB | 3.20 MiB/s, done.
Resolving deltas: 100% (269122/269122), done.
Checking connectivity... done.
eddie@abyss [~] $ cd ezpublish-legacy
eddie@abyss [~/ezpublish-legacy] ( ± master ) $ composer install
<?php
namespace Netgen\Bundle\ToolsBundle\Helper;
use eZ\Publish\API\Repository\Values\Content\Query;
use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
use eZ\Publish\API\Repository\Values\Content\Location;
class SortClauseHelper
{
@emodric
emodric / RelationList.php
Created August 7, 2015 08:39
eZ Publish RelationList field type with location ID support
<?php
namespace Netgen\Bundle\HelperBundle\Core\Persistence\Legacy\Content\FieldValue\Converter;
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\RelationList as BaseRelationListConverter;
use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
use eZ\Publish\SPI\Persistence\Content\FieldValue;
@emodric
emodric / gist:34166413297e0990e0c2
Created April 14, 2015 11:09
Vagrant composer update
vagrant@vagrant-ubuntu-trusty-64:/var/www/project$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(784): Symfony\Component\Console\Application->ge
eddie@abyss: ~/www/vagrant-ansible-symfony [feature/ez-setup] $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: vagrant-ansible-symfony_default_1422352584617_91260
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
eddie@abyss: ~/www/vagrant-ansible-symfony [feature/ez-setup] $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: vagrant-ansible-symfony_default_1422349667711_72214
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
TASK: [apache | Install Apache] ***********************************************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE apt name=apache2 state=present update_cache=yes
<127.0.0.1> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/eddie/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o Port=2222 -o IdentityFile="/var/www/html/vagrant-ansible-symfony/.vagrant/machines/default/virtualbox/private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 127.0.0.1 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1421918430.46-279641966512076 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1421918430.46-279641966512076 && echo $HOME/.ansible/tmp/ansible-tmp-1421918430.46-279641966512076'
<127.0.0.1> PUT /tmp/tmp7NpaJs TO /home/vagrant/.ansible/tmp/ansib
<?php
class Test
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
@emodric
emodric / gist:79fb2a3cc8dc35be5b12
Created June 20, 2014 15:23
Loading eZ Publish 5 role with Tag policy limitation
eddie@abyss: ~/repos/emodric/rest_scripts [master] $ ./json/roles/08-loadRolePolicies.sh
GET /api/ezp/v2/user/roles/5/policies HTTP/1.1
Accept: application/vnd.ez.api.PolicyList+json
Accept-Encoding: gzip, deflate, compress
Host: ezpublish5.local
User-Agent: HTTPie/0.7.2
HTTP/1.1 200 OK