Skip to content

Instantly share code, notes, and snippets.

View amans199's full-sized avatar

Ahmed Mansour amans199

View GitHub Profile
@amans199
amans199 / JavaScript Loops Performance test
Last active October 28, 2021 10:42
JavaScript Loops Performance test
console.log('Hello World');
//https://stackoverflow.com/questions/5349425/whats-the-fastest-way-to-loop-through-an-array-in-javascript
const timer = function* (time) {
yield new Date().getTime() / 1000 - time
}
const timing = timer(new Date().getTime() / 1000);
@amans199
amans199 / wp_hint.txt
Last active October 31, 2020 16:55
Wordpress_Hints:: including all files inside a directory
define('DEFAULT_PATH', plugin_dir_path(__FILE__));
foreach (glob(DEFAULT_PATH . "templates/*.php") as $file) {
include_once $file;
}
@amans199
amans199 / TGM For ACF
Created May 5, 2020 20:12
TGM For ACF
add_action( 'tgmpa_register', 'register_required_plugins' );
// This function is called from the above hook
function register_required_plugins()
{
// The plugins array allows us to define multiple plugins we want to include.
// The commented out example shows how we can include and activation a bundled
// plugin zip file in our theme.
$plugins = array(
/* array(
@amans199
amans199 / ACF Arabian Country list
Created February 10, 2020 06:43
Arabian Country list formatted for Advanced Custom Fields select dropdown
algeria : Algeria
bahrain : Bahrain
comoros : Comoros
djibouti : Djibouti
egypt : Egypt
iraq : Iraq
jordan : Jordan
kuwait : Kuwait
lebanon : Lebanon
libya : Libya