Categories
Technical

What is coding ?

1 - Implement code
2 - DRY (Review Code Improvements) - Do not repeat yourself
3 - Unit Test
4 - Api Documentation + PHP DocBlock
5 - Code Styling PSR-2

There is a difference between hacking and coding. For business purposes developers tended to hack which is profitable for certain situation rather small environments. However when the team grows and when the code needs to be shared, it is ineluctable that some good practice needs to be setup. Unit tests guarantee the stability of your application for every and each incremental release/deployment of your application.

Get the developers to understand that point is critical. Explaining that this practice will allow them not to be blamed after each release, they will be stress free and confident is crucial.

Obviously, this comes with more work since you now need to test your code, and write unit test, making the task more strenuous, but this is indeed HARD WORK

Documenting as well is critical especially if supporting APIs, swagger comes handy for that purpose

Categories
BEST PHP CODE PHP

How to use PHP DocBlock ?

/**
 * Returns a list of XXXXXXX
 *
 * @param string $route_group_uuid
 *
 * @return Array $listCarrierRoute
 *
 * @throws \Exception
 *
 * @version 05-05-2020
 * @author David Raleche <[email protected]>
 * @reference JIRA Ticket PMM2-862 Create route groups XXXXX
 */
Categories
Nginx

NGINX Configuration BLOCK URLS

location ~* ^/log(\/)?$ { 
    return 404; 
}
 
location ~* ^/swagger(.*)$ { 
    return 404; 
}
Categories
General Technical

How to mage Immutable File Unix ?

lsattr /etc/pgbouncer/users.txt
 ----i--------e- /etc/pgbouncer/users.txt

lsattr /etc/pgbouncer/users.txt
----i--------e- /etc/pgbouncer/users.txt
 
sudo chattr -i /etc/pgbouncer/users.txt
lsattr /etc/pgbouncer/users.txt
 -------------e- /etc/pgbouncer/users.txt
 
vim /etc/pgbouncer/users.txt
sudo chattr +i /etc/pgbouncer/users.txt
lsattr /etc/pgbouncer/users.txt
----i--------e- /etc/pgbouncer/users.txt
Categories
Continuous Integration/Development

How to setup Continuous Integration ?

Developers practicing continuous integration merge their changes back to the main branch as often as possible. The developer’s changes are validated by creating a build and running automated tests against the build. By doing so, you avoid the integration hell that usually happens when people wait for release day to merge their changes into the release branch.

Continuous integration puts a great emphasis on testing automation to check that the application is not broken whenever new commits are integrated into the main branch.

Categories
Technical

What are the Benefits of pull requests ?

  • Use this collaborative platform to discuss potential modifications to the code.
  • Improve code quality.
  • Simplify the process of receiving feedback from the reviewer.
  • Address feedback easily in-line near the relevant code.
  • Provide better stability for the code.
Categories
Technical

Continuous Integration Deployment Process

Categories
Technical

Good Practice Programming with David Raleche

Categories
Laravel

Install Laravel Nova

1 - composer create-project --prefer-dist laravel/laravel admin "5.8.*"


2 - add/update in composer.json the following item
"repositories": [
     {
         "type": "composer",
         "url": "https://nova.laravel.com"
     }
 ],

Next, you may add laravel/nova to your list of required packages in your composer.json file:

"require": {
     "php": "^7.1.3",
     "fideloper/proxy": "^4.0",
     "laravel/framework": "5.8.*",
     "laravel/nova": "~2.0"
 },
3 - php artisan nova:install
4 - php artisan migrate
5- Authorizing Nova in non-local Environment
/**
 Register the Nova gate.
 *
 This gate determines who can access Nova in non-local environments.
 *
 @return void
 */
 protected function gate()
 {
 Gate::define('viewNova', function ($user) {
     return in_array($user->email, [
         '[email protected]',
     ]);
 });
 } 
#6 - Deploy with credentials
composer config http-basic.nova.laravel.com [email protected] mxxxxxxxxxxxxxxxxg
Categories
Git

Git got to a particular hash version

Use git checkout <sha1> to check out a particular commit.