Skip to content

Instantly share code, notes, and snippets.


Denis Žoljom dingo-d

View GitHub Profile
billerickson / gist:2047229
Last active Apr 5, 2021
Improve performance of WP_Query
View gist:2047229
$args = array(
// Normal query goes here //
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
da1nonly / gist:2057532
Created Mar 17, 2012
wordpress meta box urls
View gist:2057532
add_action('admin_init', 'add_meta_boxes', 1);
function add_meta_boxes() {
add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high');
function repeatable_meta_box_display() {
global $post;
tkihira / gist:3014700
Created Jun 28, 2012
mkdir, rmdir and copyDir(deep-copy a directory) in node.js
View gist:3014700
var mkdir = function(dir) {
// making directory without exception if exists
try {
fs.mkdirSync(dir, 0755);
} catch(e) {
if(e.code != "EEXIST") {
throw e;
View JSLint Options Descriptions
anon true, if the space may be omitted in anonymous function declarations
bitwise true, if bitwise operators should be allowed
browser true, if the standard browser globals should be predefined
cap true, if upper case HTML should be allowed
continue true, if the continuation statement should be tolerated
css true, if CSS workarounds should be tolerated
debug true, if debugger statements should be allowed
devel true, if logging should be allowed (console, alert, etc.)
eqeq true, if == should be allowed
es5 true, if ES5 syntax should be allowed
brasofilo / comments-2-excel.php
Last active Apr 1, 2018
Export WordPress Comments as Excel file. Uses PHPExcel, Place this file in the root of the WordPress installation. TODO: convert to plugin.
View comments-2-excel.php
# Load slim WP
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->comments
iamnewton /
Last active Oct 26, 2021
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
View gitcheats.txt
# get list of all author's emails of the repo
git log --format="%ae" | uniq
# shortform git commands
alias g='git'
# show contents of all git objects in a git repo
find .git/objects/ -type f \| sed 's/\.git\/objects\/\///' | sed 's/\///g' | xargs -n1 -I% echo echo "%" \$\(git cat-file -p "%"\) \0 | xargs -n1 -0 sh -c
# push all branches to all remotes
pippinsplugins / gist:9201867
Created Feb 25, 2014
Simple example of how to use SCRIPT_DEBUG to load non-minified assets
View gist:9201867
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
adamsilverstein / expanded_alowed_tags
Last active Apr 16, 2020
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
View expanded_alowed_tags
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),