Skip to content

Instantly share code, notes, and snippets.

View sabrysuleiman's full-sized avatar
🏠
Working from home

Sabry Suleiman sabrysuleiman

🏠
Working from home
View GitHub Profile
@sabrysuleiman
sabrysuleiman / gist:4d91db55bef76f63909cc2fc49c5a8c9
Created February 13, 2025 06:38
VSCdode Copilot Keyboard shortcut ( Ubuntu )
# chat About you Code ( Ctrl + Alt + I )
# Make changes using natural language ( Ctrl + Shift + Alt + I )
@sabrysuleiman
sabrysuleiman / Response.php
Created November 13, 2024 14:18 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@sabrysuleiman
sabrysuleiman / indexnow api
Created October 8, 2024 18:35
indexnow api
# create api key
https://www.bing.com/indexnow/getstarted
# upload indexnow-api-key-file.txt to your website with content 'indexnow-api-key'
# indexnow.org
https://api.indexnow.org/indexnow?url=https://site.net/page-url/&key=indexnow-api-key
# bing.com
https://www.bing.com/indexnow?url=https://site.net/page-url/&key=indexnow-api-key
@sabrysuleiman
sabrysuleiman / gist:4a9c40d2e096ce0e3b3f6681eb1e88b7
Created October 3, 2024 19:06
Wordpress tinymce windowManager body types
editor.windowManager.open({
title: 'Options',
body: [
{
type : 'listbox',
name : 'imgalign',
label : 'Image direction',
values : [
{ text: 'Image right', value: 'right' },
@sabrysuleiman
sabrysuleiman / CSS media queries
Created July 1, 2024 15:05
CSS media queries
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
}
<script>
function loadScript(url) {
let isLoaded = document.querySelectorAll('.search-script');
if(isLoaded.length > 0) { return; }
let myScript = document.createElement("script");
myScript.src = url;
myScript.async = 'async';
myScript.className = 'search-script';
document.head.appendChild(myScript);
}
@sabrysuleiman
sabrysuleiman / functions.php
Created November 18, 2023 18:25
lazy load wordpress content images
function add_lazy_loading_to_images($content) {
// Add loading="lazy" to all <img> tags in the content
$content = preg_replace('/<img(.*?)src=(["\'])(.*?)\2(.*?)>/i', '<img$1loading="lazy" src=$2$3$2$4>', $content);
return $content;
}
add_filter('the_content', 'add_lazy_loading_to_images');
@sabrysuleiman
sabrysuleiman / .htaccess
Created November 18, 2023 18:23 — forked from lukecav/.htaccess
Browser caching for Apache
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/avif-sequence "access plus 1 year"
@sabrysuleiman
sabrysuleiman / gist:227141bc5fe3f19dab73d5374f4ec8e4
Created November 15, 2023 17:52
Installing Apache Cordova on Ubuntu
# Install Node.js and npm
sudo apt update
sudo apt install nodejs
sudo apt install npm
# Install Cordova
sudo npm install -g cordova
# Create a Cordova Project
cordova create MyAndroidApp
@sabrysuleiman
sabrysuleiman / make Apache run as current user
Created June 30, 2023 18:49
make Apache run as current user
export APACHE_RUN_USER=username
export APACHE_RUN_GROUP=www-data
sudo adduser username www-data