Skip to content

Instantly share code, notes, and snippets.

View egyjs's full-sized avatar
:shipit:
the perfect man for the job

AbdulRahman El-zahaby egyjs

:shipit:
the perfect man for the job
View GitHub Profile
<?php
namespace App\Traits;
use App\Exports\ExcelExport;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Facades\Excel;
trait Exportable
String.prototype.replaceTemplateVars = function (data){
let str = this;
// data is object
for (let key in data) {
str = str.replace(new RegExp(`{${key}}`, 'g'), data[key]);
}
return str;
}
document.addEventListener("DOMContentLoaded", function() {
// Global Variables
@egyjs
egyjs / git-bisect.md
Created January 13, 2023 15:42
Useful tips

One useful Git tip is to use the command "git stash", to find the commit that introduced a bug in your code. This command allows you to perform a binary search through your commits to quickly locate the commit that caused the bug.

For example, let's say you have a bug in your code and you know it was not present in a previous version. You can use the command "git bisect" to start the search process:

$ git bisect start
google.com, pub-5651806558038479, DIRECT, f08c47fec0942fa0
@egyjs
egyjs / test.xml
Created August 31, 2021 15:10
twiml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>$content</Say>
<Play>https://vttts.readspeaker.com/cgi-bin/nph-voicetext/17c6a09ed76c9306e9cedcc9c645cce9.mp3</Play>
</Response>
@egyjs
egyjs / readme.md
Last active June 20, 2021 14:56
new kinux os install setup

init

sudo apt update -y && sudo apt upgrade -y
sudo apt install php-xml php-mysql php-curl php-mbstring  -y
sudo apt install composer -y
sudo install snap && sudo snap

// if snap is installed successfully

@egyjs
egyjs / get.py
Last active February 21, 2021 00:40
get ts, m3u8 files video and convert it to mp4
import os
folderName = 'folderName'
fileurl = "fileurl"
m3u8file = folderName+"/m3u8/480p.m3u8"
if not os.path.exists(folderName):
os.makedirs(folderName)
@egyjs
egyjs / variousCountryListFormats.js
Created July 15, 2020 19:14 — forked from incredimike/variousCountryListFormats.js
Country list as javascript array (alphabetical)
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: Nov 15, 2019
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
// List of all countries in a simple list / array.
$('form').submit(function (event) {
event.preventDefault();
var _this = $(this);
$.ajax({
type: "POST",
url: _this.attr('action'),
data: new FormData(this),
processData: false,
contentType: false,
success: function (data) {
@egyjs
egyjs / auto replace SRC,HREF with Laravel functions.md
Last active July 5, 2024 14:37
[laravel asset function] how to auto replace SRC,HREF with Laravel function using regex

This is the best I have so far using regex:

Find:

<((?!\s*((a)\s+))\w+)(.*?)((?:src|href)\s*=\s*")((?!\{\{\s*)[^"]+)"

Replace with:

&lt;$1$4$5{{ asset('$6') }}"