Skip to content

Instantly share code, notes, and snippets.

View lolautruche's full-sized avatar

Jérôme Vieilledent lolautruche

View GitHub Profile
<?php
$foo = function (&$arg) {
var_dump($arg);
};
$a = 'bar';
$b =& $a;
// Warning: Parameter 1 to {closure}() expected to be a reference, value given in /Users/lolautruche/Desktop/reference.php on line 8
call_user_func_array($foo, [$b]);
@lolautruche
lolautruche / 0 - Readme.md
Last active August 29, 2015 14:04
Oro DistributionBundle split

Subtree split of OroCRM/DistributionBundle

  1. Clone the base repository into oro-platform directory:

    git clone git@github.com:lolautruche/platform.git oro-platform
    git remote add upstream git@github.com:orocrm/platform.git
    git config branch.master.remote upstream
  2. Run the 2 shell scripts, split_oro_config_component.sh and split_oro_distribution_bundle.sh

@lolautruche
lolautruche / pagelayout.html.twig
Created September 22, 2014 07:36
eZ language switcher and legacy routes
{# Pagelayout from SiteBundle #}
{% block menu %}
{# Assuming you may have your own menu markup here as well #}
{# Defaults to the current route, unless routeRef is already defined #}
{% set routeRef = routeRef|default( ez_route( params={"language": "esl-ES"} ) ) %}
{% endblock %}
@lolautruche
lolautruche / 00 - services.yml
Last active August 29, 2015 14:07
Dynamic settings injection 1/4, before eZ 5.4 / 2014.09
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
services:
acme_test.my_service:
class: %acme_test.my_service.class%
arguments: [@ezpublish.config.resolver]
@lolautruche
lolautruche / 00 - services.yml
Last active August 29, 2015 14:07
Dynamic settings injection 2/4, as eZ 5.4 / 2014.09 - Setter injection
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
services:
acme_test.my_service:
class: %acme_test.my_service.class%
calls:
# Will resolve ezsettings.<current_siteaccess>.languages
- [setLanguages, ["$languages$"]]
- [setRootLocationId, ["$content.tree_root.location_id$"]]
@lolautruche
lolautruche / 0 - services.yml
Last active August 29, 2015 14:07
Dynamic settings injection 3/4, as of eZ 5.4 / 2014.09 - Constructor injection
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
services:
acme_test.my_service:
class: %acme_test.my_service.class%
arguments: ["$languages$", "$content.tree_root.location_id$"]
@lolautruche
lolautruche / 00 - services.yml
Last active August 29, 2015 14:07
Dynamic settings injection 4/4, as of eZ 5.4 / 2014.09 - 3rd party parameters
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
# "acme" is our parameter namespace.
# Null is the default value.
acme.default.some_parameter: ~
acme.ezdemo_site.some_parameter: foo
acme.ezdemo_site_admin.some_parameter: bar
services:
@lolautruche
lolautruche / 00 - parameters.yml
Last active August 29, 2015 14:07
Assetic and eZ dynamic settings
parameters:
acme.my_siteaccess.css.files:
- "foo.css"
- "some_dir/bar.css"
<?php
public function trashSubtree( $locationId )
{
$location = $this->load( $locationId );
// Create new trashed location and remove original location from tree
$params = (array)$location;
$params['locationId'] = $locationId;
// Be sure to not overlap id
unset( $params['id'] );
<html>
<head>
<title>JQuery - FadeIn() et FadeOut() - Exemple</title>
<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#boutonFadeOut").click(function () {
$("#contenu").fadeOut();
});
$("#boutonFadeIn").click(function () {