Skip to content

Instantly share code, notes, and snippets.

View ahmedsayedabdelsalam's full-sized avatar

Ahmed Sayed ahmedsayedabdelsalam

View GitHub Profile
alias .='xdg-open .'
alias 2='/var/www/html'
alias c=clear
alias comda='composer dump-autoload'
alias comi='composer install'
alias comu='composer update'
alias nrd='npm run dev'
alias nrw='npm run watch'
alias pa='php artisan'
alias pacc='php artisan cache:clear'
<?php
if (!function_exists('classActivePath')) {
function classActivePath($segment, $value)
{
if(!is_array($value)) {
return Request::segment($segment) == $value ? ' menu-open' : '';
}
foreach ($value as $v) {
if(Request::segment($segment) == $v) return ' menu-open';
}
@ahmedsayedabdelsalam
ahmedsayedabdelsalam / cloudSettings
Last active September 15, 2020 00:58
code95-vscode
{"lastUpload":"2020-09-15T00:58:07.652Z","extensionVersion":"v3.4.3"}
// add this to ~/.ideavimrc file to switch to normal mode with (jj) key bindings
imap jj <Esc>
// add the following command to ~/.zshrc to restore your zsh history inside phpstorm's terminal
export HISTFILE=$HOME/.zsh_history
@ahmedsayedabdelsalam
ahmedsayedabdelsalam / phpstorm_live_templates.txt
Last active June 27, 2020 05:46
phpstorm live templates
// (querylog) surounds a block of code with laravel qurey log
// https://twitter.com/a7medsayed/status/1276724409974296577
\DB::enableQueryLog();
$SELECTION$
\Log::info('query-log', [\DB::getQueryLog()]);
// (querycount) surounds a block of code with laravel qurey log count
\DB::enableQueryLog();
<?php
/**
* we have a cart with coupon and we need to calculate the discount amount
*
* Note:
* - the coupon support multiple conditions
* - the included and excluded are optional
*/
// Order Data
// wiki for onboarding build with laravel
https://www.bookstackapp.com/
// empty password for mysql
https://linuxconfig.org/mysql-allow-empty-password
// find matches
grep -r 'something' /path/to/file.txt
// replace inline in files
#! /bin/bash
#####################################################
echo "abdelsalam" >> file.txt
#####################################################
#####################################################
: '
ahmed
sayed
<?php
namespace App\Http\Traits;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Resources\Json\JsonResource;
trait ApiResponder
{
/**