Skip to content

Instantly share code, notes, and snippets.

View mmousawy's full-sized avatar
✳️
Evolving

Murtada al Mousawy mmousawy

✳️
Evolving
View GitHub Profile
@mmousawy
mmousawy / functions.php
Last active May 6, 2020 23:34
Add oEmbed support to ACF WYSIWYG fields (acf_the_content)
<?php
/**
* Add oEmbed support to ACF WYSIWYG fields.
*
* Fixes issue with WP-native oEmbeds not working in ACF WYSIWYG fields because
* these fields are saved in the database without post IDs. WP's oEmbed works out
* of the box only with direct post content.
*/
@mmousawy
mmousawy / cte_examples.sql
Last active February 27, 2024 01:48
Recursive SQL SELECT, UPDATE and DELETE with recursive CTE in MariaDB
-- SELECT
WITH recursive custom_cte AS
( SELECT
*
FROM
target_table
WHERE
target_table.id = "value"
@mmousawy
mmousawy / install.sh
Last active March 25, 2019 16:21
Installing H2O server from source on Debian 9
# See https://h2o.examp1e.net/install.html for more info.
# Update apt-get library
sudo apt-get update
# Install cmake
sudo apt-get install cmake
# Install build tools (CXX compiler)
sudo apt-get install build-essential
@mmousawy
mmousawy / commands.md
Created March 16, 2019 19:05
Android Debug Bridge (adb) pull and push commands

Check if device is connected and running

./adb devices

Pull files from device to directory

./adb pull "/sdcard/<filename or dir>" "<destination dir>"

Push files to device

@mmousawy
mmousawy / scrollbarwidth.js
Last active March 16, 2019 00:31
Get scrollbar width JavaScript
// Easy immediately invoked function expression (IIFE) to find the current scrollbar width in browser
// Returns a number of scrollbar width in pixels
const scrollBarWidth = (() => {
const a = document.createElement('div');
document.body.appendChild(a).style.overflowY = 'scroll';
const w = a.offsetWidth - a.clientWidth;
a.remove();
return w;
})();
@mmousawy
mmousawy / encode-svg-uri.scss
Created February 28, 2019 13:24
Encode SVG URI and inline SCSS
@function encode-uri($uri) {
$enc: str-replace($uri, '"', "'");
$enc: str-replace($enc, '<', '%3C');
$enc: str-replace($enc, '>', '%3E');
$enc: str-replace($enc, '&', '%26');
$enc: str-replace($enc, '#', '%23');
@return $enc;
}
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\.bmp]
@="PhotoViewer.FileAssoc.Tiff"
[HKEY_CURRENT_USER\SOFTWARE\Classes\.gif]
@="PhotoViewer.FileAssoc.Tiff"
[HKEY_CURRENT_USER\SOFTWARE\Classes\.ico]
@mmousawy
mmousawy / command.md
Created July 31, 2017 08:52
SSH port forward Scotch Box MySQL to localhost

ssh -fNL 3306:localhost:3306 vagrant@192.168.33.10

@mmousawy
mmousawy / Node SASS watch CLI
Last active January 15, 2018 20:55
Node SASS watch
node-sass -w main.scss main.css --output-style compressed
node-sass -w scss/ -o css/ --output-style compressed