Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Finalizing

Juyal Ahmed tojibon

:octocat:
Finalizing
View GitHub Profile
@tojibon
tojibon / upgrade-php7.sh
Last active Mar 20, 2020 — forked from skynet/upgrade-php7.sh
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
View upgrade-php7.sh
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5
#
# Must be ran as sudo:
# sudo bash upgrade-php7.sh
#
# Can be added to ./.ebextensions/20_php.config like so:
# container_commands:
@tojibon
tojibon / readme.md
Last active Nov 20, 2019
Installing AWS KubeCTL on Windows
View readme.md
  1. Visit https://aws.amazon.com/cli/ and install AWS CLI Client
  2. Visit https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows and install Kubernetes CLI Client
  3. Configure AWS CLI - aws configure
AWS Access Key ID [None]: AKIAJXXXXXXEWDNXXXXX
AWS Secret Access Key [None]: 2EqCQXXXXXuK3LXXXXXtZXMGNXXXXXVCHd0XXXXX
Default region name [None]: eu-central-1
Default output format [None]: JSON
  1. Configure Amazon EKS (Elastic Kubernetes Service) - aws eks --region eu-central-1 update-kubeconfig --name phpfarmer-kube1
@tojibon
tojibon / mysql.md
Last active May 9, 2019
Search for a specific column name in all the tables in MySQL database?
View mysql.md
SELECT    
    table_name, 
    ordinal_position    
FROM INFORMATION_SCHEMA.COLUMNS    
WHERE    
    table_schema = 'DB_NAME' AND    
    column_name='column_name';
@tojibon
tojibon / composer.json
Last active May 8, 2019
Creating a package with Laravel 5.6 for a printing company ex: Alpha and the package name ex: Library.
View composer.json
{
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Alpha\\Library\\": "packages/Library/src/"
}
@tojibon
tojibon / readme.MD
Last active May 27, 2019
My Laravel Best Practices
View readme.MD
  • Always follow PSR2 - PSR4 php coding style, better install it on PHPStorm
  • Always validate things via RequestValidators even if it is nullable(), Move validation from controllers to Request classes.
  • Use child relationships to get child data and filter data
  • Make sure if there is any auto generated codes like __construct
  • How can a array count ever be less than 0? Check to use a simple condition instead of making it complex with double check
  • Check if there is anything should actually fail if it doesn't have a set value
  • It's a good idea to check first for the less costly conditions (especially inside a loop)
  • Always use Carbon for date processing
  • Maintain code commenting and proper docblock
  • Always use custom env for static values, do not get data from the .env file directly
@tojibon
tojibon / readme.md
Last active Apr 27, 2019
Setting up VirtualHost for Symfony App in Ubuntu
View readme.md
sudo vim /etc/apache2/sites-available/symfony-test-app.conf
<VirtualHost *:80>
  ServerName symfony-test-app.com
  <IfModule mod_rewrite.c>
    RewriteEngine on
@tojibon
tojibon / api.php
Last active Apr 17, 2019
Laravel fire an Artisan command from an HTTP route by using Artisan facade
View api.php
<?php
Route::get('/foo', function()
{
$exitCode = Artisan::call('command:name', ['--option' => 'foo']);
//
});
?>
@tojibon
tojibon / bash.md
Created Apr 12, 2019
Installing symfony client
View bash.md
wget https://get.symfony.com/cli/installer -O - | bash
export PATH="$HOME/.symfony/bin:$PATH"
sudo mv /home/juyal/.symfony/bin/symfony /usr/local/bin/symfony
View Artisan.md
// Added in 5.1.11:http://laravel.com/docs/5.1/authorization#creating-policies
php artisan make:policy PostPolicy
// Displays help for a given command
php artisan --help OR -h
// Do not output any message
php artisan --quiet OR -q
// Display this application version
php artisan --version OR -V
// Do not ask any interactive question
@tojibon
tojibon / gitflow-breakdown.md
Created Apr 1, 2019 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository