Bitbucket is good for free private repos
Github is good for free public repos, for demonstration of your work

Difference between Strategy and Factory design patterns

A Strategy pattern is an operational pattern. Strategy pattern allows you to polymorphically change behavior of a class. Strategy pattern is to avoid conditionals switching in favor of polymorphism.
So, Strategy pattern = polymorphism.

A Factory pattern is a creational pattern. Factory pattern allows you to encapsulate object creation.
Factory pattern = encapsulation.

A difference between Simple Factory and Abstract Factory. Simple Factory – you only have one class which acts as a factory for object creation. Abstract Factory – you connect to an interface and then call the different factories that implement this interface which are supposed to have different implementations of the same method based on some criteria.

Abstract Factory looks like a strategy pattern, but it differs from it semantically because it is used for OBJECT CREATION rather than operations. So, basically you have object creation using different strategies.

PHP PSR-1 Explained

      Class names MUST be declared in StudlyCaps.
      Class constants MUST be declared in all UPPER_CASE with underscore separators.
      Method names MUST be declared in camelCase.

Ubuntu Skype enable group chat

/msnp24

simply need to cope and past to someone that is not online
in the chat then restart the skype and you are done

Swiftmailer sending email via gmail.com

 
<?php
 
    $transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com',465)
        ->setUsername('yourusername@yourdomain.com')
        ->setPassword('yourpassword')
        ->setEncryption('ssl')
        ->setAuthMode('login');
 
    $mailer = \Swift_Mailer::newInstance($transport);
 
    $message = \Swift_Message::newInstance()
        ->setSubject('Welcome')
        ->setFrom(array('yourusername@yourdomain.com'))
        ->setTo(array('to@to.com'))
        ->setBody('hello world')
        ->setContentType("text/plain");
 
    $mailer->send($message);

Git restore local branch deleted by mistake

 
1. git reflog | grep pp-auth-r1.1 
response: 592b75b
2. git branch 2.7.4-69179 592b75b

Silex Microframework structure points

1. A bootstrap (app/bootstrap.php) and application file (app/app.php) which could be used by my frontend controller, as well as by PHPUnit/Codeception

2. A web directory that is accessible for the world, containing only index.php and possibly some resources web/index.php

Ubuntu using Lxrandr to position second monitor

lxrandr

saves configuration to: /home/imran/.config/autostart/lxrandr.desktop
sample:

[Desktop Entry]
Type=Application
Exec=xrandr --output HDMI1 --mode 1920x1080 --rate 60.00 --output eDP1 --mode 1920x1080 --rate 60.00 --left-of HDMI1
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=LXRandR
Name=LXRandR
Comment[en_GB]=To keep laptop on the left handside with monitor in the center
Comment=To keep laptop on the left handside with monitor in the center
imran@imran-Lenovo-Z51-70:~/.config/autostart$

PSR-2 Conding standard checker

vendor/bin/php-cs-fixer fix path/to/folder --level="psr2" -v

The –dry-run option displays the files that need to be fixed but without actually modifying them

vendor/bin/php-cs-fixer fix path/to/file --level="psr2" --dry-run --diff -v

MySQL Profiling

set profiling=1;
call functionname(@functionparam);
show profiles;