Skip to content

Instantly share code, notes, and snippets.

View MrShennawy's full-sized avatar

Mahmoud Shenawy MrShennawy

View GitHub Profile
# shellcheck disable=SC2168
# shellcheck disable=SC1087
# Shennawy's theme
#
# This a theme for oh-my-zsh. Features a colored prompt with:
# * ➜ workdir git:(git) $
# * '$' prompt will be green if last command return value is 0, red otherwise.
#
# git prompt is inspired by official git contrib prompt:
@MrShennawy
MrShennawy / nineteenTask.php
Last active November 10, 2018 23:43
get count of (nineteen) word in random string
<?php
$str = "nnteirnnyeutbneveectnifngninejtfeesexn";
$strlen = strlen( $str );
$nChar = 0;
$iChar = 0;
$eChar = 0;
$tChar = 0;
@MrShennawy
MrShennawy / script.js
Created September 9, 2018 14:52
Calculate YouTube Playlist total time
Number.prototype.padDigit = function () {
return (this < 10) ? '0' + this : this;
}
var time1 = "00:00";
var secs = 0;
var mins = 0;
var hrs = 0;
$('.ytd-thumbnail-overlay-time-status-renderer').each(function(){
@MrShennawy
MrShennawy / index.php
Created January 12, 2018 07:48
how to get custom number of items in the same row at every loop
<?php
$arr = ['a','b','c','d','f','g'];
$a = 0;
foreach ($arr as $value) {
// 3 it's number of items
if($a % 3 == 0){
echo "<br>";
}
echo $value;
$a++;
@MrShennawy
MrShennawy / index.html
Last active March 26, 2018 14:24
Run a specific event at a certain time just Js
<!DOCTYPE html>
<html>
<head>
<title>تجربة تشغيل حدث معين فى وقت معين</title>
<meta charset="utf-8">
</head>
<body>
<span class="timePrayer" style="color:#004dff;" data-time="05:20 AM"> الوقت الأول </span><br>
<span class="timePrayer" style="color:#004dff;" data-time="11:55 AM"> الوقت الثانى </span><br>
<span class="timePrayer" style="color:#004dff;" data-time="02:55 PM"> الوقت الثالث </span>
@MrShennawy
MrShennawy / 1_customFunctions.php
Last active May 16, 2024 15:04
now you can query by regexp in laravel !! بالعربى إزاى تعمل بحث بالألف همزه ومن غير وهكذا ة ه وال ي وي ..... إلخ
<?php
//الملف ده اللى بيكون موجود فيه الدوال المساعده للشغل وغالبا بيكون مساره كالتالى
// app/helper/help.php
// ملحوظه (الملف ده انت اللى بتعمله عشان تحط جوا الفنكشنز اللى هتساعدك فى شغلك )0
#================ search at sql text to regx =====================================
function sql_text_to_regx($string){
$alamat = array("+","=","-","_",")","(","*","&","^","%","$","#","@","!","/","\\","|",">","<","?","؟");
$alamat_change = "";
$alef = array("ا","أ","آ","إ");