Skip to content

Instantly share code, notes, and snippets.

View juyal-ahmed's full-sized avatar
:octocat:
Finalizing

Juyal Ahmed juyal-ahmed

:octocat:
Finalizing
View GitHub Profile
@juyal-ahmed
juyal-ahmed / paper-canvas.vue
Created November 21, 2023 11:24 — forked from RobinMoretti/paper-canvas.vue
Simple PaperJs integration in a vuejs 3 component
<script setup>
import paper from "paper"
import { ref, onMounted } from 'vue'
const canvas = ref(null)
onMounted(()=>{
paper.setup(canvas.value);
var path = new paper.Path();
path.strokeColor = 'black';
@juyal-ahmed
juyal-ahmed / mac-setup-redis.md
Created January 27, 2022 10:49 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@juyal-ahmed
juyal-ahmed / AppServiceProvider.php
Created December 13, 2021 09:34 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@juyal-ahmed
juyal-ahmed / 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:
@juyal-ahmed
juyal-ahmed / 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
@juyal-ahmed
juyal-ahmed / 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';
@juyal-ahmed
juyal-ahmed / 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/"
}
@juyal-ahmed
juyal-ahmed / 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
@juyal-ahmed
juyal-ahmed / 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
@juyal-ahmed
juyal-ahmed / api.php
Last active April 17, 2019 08:04
Laravel fire an Artisan command from an HTTP route by using Artisan facade
<?php
Route::get('/foo', function()
{
$exitCode = Artisan::call('command:name', ['--option' => 'foo']);
//
});
?>