Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / listAllEventListeners.js
Created April 23, 2023 03:01 — forked from tkafka/listAllEventListeners.js
List all event listeners in a document
console.table((function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document); // we also want document events
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {
@Shoora
Shoora / Google-Analytics-Asynchronous-Tracking-Code-Example.html
Created April 13, 2023 01:03
Google Analytics Asynchronous Tracking Code Example
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
@Shoora
Shoora / local-config.php
Created April 12, 2023 07:58 — forked from jeffsebring/local-config.php
WordPress Pro Config
<?php
# Turn on Caching
#define('WP_CACHE', true);
# Set the Memory Limit
#define('WP_MEMORY_LIMIT', '64M');
# Development Table prefix
#$table_prefix = 'dev_';
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@Shoora
Shoora / wordpress-get-child-page-ids.php
Created April 12, 2023 07:40 — forked from chuckreynolds/wordpress-get-child-page-ids.php
Gotta be a better way to get an array of Child Page IDs than this. WordPress
<?php
// basic idea here is a common function to pass a parent page ID
// and get back an array of it and its child page IDs only
function getChildPageIDs( $id ) {
$child_pages = get_pages('child_of='.$id);
$ids_to_remove = array($id); // we want to remove parent id too
foreach($child_pages as $child) {
array_push($ids_to_remove,$child->ID); // for every child add the id into array
}
<?php
/**
* Log any errors for debugging.
*
* @global WP_DEBUG
* @uses error_log
* @var string|array $message the error message (a string or array)
*/
if( !function_exists( 'jdn_log_me' ) ) {
function jdn_log_me( $message ) {