programming principles

Created at: 2020-02-28 13:50:06 Updated at: 2020-03-24 14:06:55

KISS

DRY!

SOLID

SOLID

how to get all twig variables from template

Created at: 2020-03-11 17:33:18 Updated at: 2020-03-11 18:07:18

This is how I use to debug any twig template and it's variables.

Just include into  your twig template and pass variable = object | array | null
{% partial 'debug' variable=post %}
{% if this.environment != ('production' or 'prod' ) %}
    <ol>
        {% if variable is defined %}
            {% set debugItem = variable %}
        {% else %}
            {% set debugItem = _context %}
        {% endif %}

        {% if debugItem is iterable %}
            {% for key, values in debugItem  %}
            <li><b>{{ key }}</b></li>
            <ol>
                {% if values is iterable %}
      ...

Linux user permission right way

Created at: 2019-08-13 08:13:46 Updated at: 2020-03-10 14:03:35

in Featured, Laravel, Linux, Magento, Performance

To solve linux user and group permission issue for any kind of project.

First of all find the right user and right group which is executing that process.

Silver bullet of linux user permission.

sudo lsof -iTCP -sTCP:LISTEN -Pn
export OWENRE=$(whoami)
export GROUP=$(whoami)

Use above command to grap process and find whois the right owner of that process and export variable as OWENRE and GROUP

sudo chgrp $GROUP * -Rf
sudo chown $OWENRE * -Rf
sudo find ./ -type f -exec chmod 664 {} \;    
sudo find ./ -type d -exec chmod 775 {} \;

Laravel specific issue.

sudo chgrp -R www-data storage bootstrap/...