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 / 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 ) {
@Shoora
Shoora / custom-field-shortcode.php
Created April 5, 2023 21:06 — forked from joshuadavidnelson/custom-field-shortcode.php
Add shortcode support to custom field output
<?php
/**
* Apply shortcodes to custom field output
*
* @author Joshua David Nelson, [email protected]
*/
$custom_field_output = 'some text with a [shortcode]';
add_filter( 'custom_field', 'do_shortcode' );
$custom_field_output = apply_filters( 'custom_field', $custom_field_output );
@Shoora
Shoora / nix-reference.md
Created April 5, 2023 20:55 — forked from pebreo/nix-reference.md
*nix Reference

Nginx confs

{{SITES_ROOT}}/etc/nginx.conf 
/etc/nginx/conf.d/myproj.confs

/etc/nginx/sites-enabled/default
/etc/nginx/sites-available/myconf.conf
ln -s [source] [target]
ln -s /etc/nginx/sites-available/myconf.conf /etc/nginx/sites-enabled/default