How to amend an older commit

Sometimes we need to update an older commit, this is solution to do it:

1. Do you changes and commit them.

2. Rebase your repository to commit you want to change:

git rebase -i {your commit id}~

3. Move your new commit directly after commit you want to update

4. Replace pick with fixup of your commit.

5. Save your changes

6. If there will be conflicts solve them and then use command:

git rebase --continue

RESTful API with Laravel

Resfull API with laravel

Watching this course I was more interested into REST api`s best practices and standards like HATEOAS implementation. I`v got understanding what HATEOAS is, and how it could be used. Also learnt again about oAuth authentification methods, scopes and so on. I consider very valuable information was about improving code base adding transformation layer.

Read more about transformation layer and it`s benefits:
http://fractal.thephpleague.com/

PhpStorm keyboard shortcuts you cannot miss

When you develop on your IDE (in our case PhpStorm) is very handy to know at least base keyboard shortcuts and save your time. Personally I’m trying to avoid using a mouse and I feel it’s more funny and professional to work without it.

You cannot miss those commands:
https://www.jetbrains.com/help/phpstorm/2016.3/keyboard-shortcuts-you-cannot-miss.html

Full keymap you can find in PhpStorm -> Help -> Keymap Reference, or directly here:
ReferenceCard

Linux install oracle instant client + PHP PDO_OCI library

Download appropriate oracle instant client
(base and sdk packages important!)

instantclient-basic-linux.x64-11.2.0.4.0.zip
instantclient-sdk-linux.x64-11.2.0.4.0.zip

 Extract those files in a directory

/opt/instantclient_11_2

Set oracle home variable

export ORACLE_HOME=/opt/instantclient_11_2/

Create symlinks for libraries

ln -s /opt/instantclient_11_2/libclntsh.so.11.1 /opt/instantclient_11_2/libclntsh.so
ln -s /opt/instantclient_11_2/libocci.so.11.1 /opt/instantclient_11_2/libocci.so
ln -s /opt/instantclient_11_2/ /opt/instantclient_11_2/lib

Install PDO_OCI
If you already have php installed, you can compile only the PDO_OCI from PHP source. (Do not install with pecl because it’s deprecated)

  • Download the PHP source with same version that you have installed
  • Extract
  • Change to directory php-YOUR-VERSION/ext/pdo_oci

Run commands to compile PDO_OCI

phpize
./configure --with-pdo-oci=instantclient,/opt/instantclient_11_2,11.2
make && make install
echo "extension=pdo_oci.so" > /etc/php.d/pdo_oci.ini

Restart web server
service httpd restart

Perfect code, does it exist?

Hey, I was thinking about a code that we write and how good it is. As developers we always have to struggle with deadlines and business changes. Sometimes we just have to do the job and then we don’t write such a clear code.

The problem is that there aren’t any boundaries in perfection and our code won’t be perfect after many years when new technologies come. I’m not trying to say that we shouldn’t use best practices and write a clean code, but we just have to do the job and maybe correct some places in the future when we have to deal with them.

In the end I would like to say: “Working application is more valuable than a perfect code”