Skip to content

Instantly share code, notes, and snippets.

View tojibon's full-sized avatar
:octocat:
Finalizing

Juyal Ahmed tojibon

:octocat:
Finalizing
View GitHub Profile
@tojibon
tojibon / upgrade-php7.sh
Last active March 20, 2020 11:01 — forked from skynet/upgrade-php7.sh
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/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 November 20, 2019 15:36
Installing AWS KubeCTL on Windows
  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 / readme.MD
Last active May 27, 2019 08:56
My Laravel Best Practices
  • 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 / install.md
Last active May 9, 2019 22:08
Installing Croogo 3.0.0-alpha.3 with CakePHP 3.x
composer create-project croogo/app croogoapp 3.0.x-dev 
cd croogoapp
bin/cake Croogo/Install.install admin admin
bin/cake server

sudo chmod -R 0777 ./tmp/cache/queries/
sudo chmod -R 0777 ./tmp/cache/persistent/
@tojibon
tojibon / mysql.md
Last active May 9, 2019 15:26
Search for a specific column name in all the tables in MySQL database?
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 13:51
Creating a package with Laravel 5.6 for a printing company ex: Alpha and the package name ex: Library.
{
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Alpha\\Library\\": "packages/Library/src/"
}
@tojibon
tojibon / readme.md
Created September 11, 2018 10:02
GIT Ignoring last few commits and roll back to existing target commit
git reset --hard 2467b9ebcc4f2487b4da5c9070e92913dc219842
git rebase -i master
git add .
git commit -m "reverted to 2467b9"
git push -f origin master
@tojibon
tojibon / readme.md
Created August 30, 2018 09:24
Multi Account Git
ssh-keygen -t rsa
ssh-add ~/.ssh/id_rsa

ssh-keygen -t rsa -C "companyName" -f "companyName"
ssh-add ~/.ssh/companyName
nano ~/.ssh/config
@tojibon
tojibon / gitflow-breakdown.md
Created April 1, 2019 14:24 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

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

@tojibon
tojibon / readme.md
Last active April 27, 2019 22:43
Setting up VirtualHost for Symfony App in Ubuntu
sudo vim /etc/apache2/sites-available/symfony-test-app.conf
<VirtualHost *:80>
  ServerName symfony-test-app.com
  <IfModule mod_rewrite.c>
 RewriteEngine on