Skip to content

Instantly share code, notes, and snippets.

@schurpf
schurpf / wp-config.php
Created September 11, 2014 15:19 — forked from philiparthurmoore/save-the-children.php
php: wp debug log for wp-config.php used in http://bit.ly/sch-psd2starker
<?php
/**
* Debugging WordPress things.
*
* All of this belongs in your wp-config.php file.
*
* This will make sure that the code you release is, at a minimum,
* relatively free of PHP notices and warnings.
*
* - WP_DEBUG: This turns on debugging mode.
@schurpf
schurpf / gist:e2188f8e0c31c9f2010c
Created October 9, 2014 21:06
php: echo ACF without wrapping p tags
/**
* ACF without paragraphs
* @author schurpf
* @url http://schurpf.com
* @version 0.0
* @date 2014-10-09
* @dependency [none]
* @param string $field_name your normal ACF field name
* @return none echos field without wrapping p tags
* @source http://support.advancedcustomfields.com/forums/topic/removing-paragraph-tags-from-wysiwyg-fields/
@schurpf
schurpf / gist:50fc8d1f9457dd37a366
Last active August 29, 2015 14:07 — forked from yratof/gist:4f312ae162f49876959c
php: wrap acf fields with barley editor
/**
* echo barley field with wrapper, use instead of the_field
* @author schurpf
* @url http://schurpf.com
* @version 0.1
* @date 2014-10-09
* @dependency barley, the_field_without_wpautop
* @param string $field_name your normal ACF field name
* @param boolean $noautop whether to omit wrapping p tags, needs the_field_without_wpautop
* @return none echos out content
@schurpf
schurpf / log
Last active August 29, 2015 14:08
php: custom file log
/**
* custom log in current directory
* @author schurpf
* @url http://schurpf.com
* @version 0.0
* @date 2014-10-28
* @dependency WP, needs plugin_dir_path
* @param string $log log message
* @param string $file filename
* @return bool return true on success
@schurpf
schurpf / wp_install.sh
Created October 24, 2014 17:51
sh: create new wp install with wp-cli
#!/bin/bash
mysql -u root -proot -e "CREATE DATABASE wp_test_setup;"
mysql -u root -proot -e "CREATE USER 'mywpuser'@'localhost' IDENTIFIED BY 'H3S7g7vkzQwGvk';"
mysql -u root -proot -e "GRANT ALL PRIVILEGES ON wp_test_setup.* TO 'mywpuser'@'localhost';"
mysql -u root -proot -e "FLUSH PRIVILEGES;"
wp core download
wp core config --dbname=wp_test_setup --dbuser=mywpuser --dbpass=H3S7g7vkzQwGvk --dbhost=localhost
wp core install --url=localhost:8888/wp-test --title="Just another test site" --admin_name=admin [email protected] --admin_password=12345
@schurpf
schurpf / Gruntfile.js
Created October 30, 2014 20:28
grunt: Gruntfile.js wordpressdeploy exclusions
'todo.txt','searchreplacedb2.php','Gruntfile.js', '.git/','.sass-cache/', 'tmp/*', 'backups/', '*.zip', 'wp-config.php', 'composer.json', 'composer.lock', 'README.md', 'searchreplacedb2.php', '.gitignore', '.idea/', 'package.json', 'node_modules', 'robots.txt', 'wp-content/uploads/snapshots/','.htaccess', 'tweet-old-post/', 'wp-to-buffer/'
@schurpf
schurpf / example-functions.php
Last active August 29, 2015 14:09
php: cmb2 text only metabox to display data, add 'type' => 'text_only' to use hook.
add_action( 'cmb2_render_text_only', 'sch_cmb_render_text_only', 10, 5 );
function sch_cmb_render_text_only( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
echo $escaped_value; //unescaped value: echo $field_object->value;
}
@schurpf
schurpf / watchr.rb
Created November 24, 2014 22:08
rb: watchr file for phpunit
watch('.*\.php') { |m| code_changed(m[0]) }
def code_changed(file)
run "phpunit"
end
def run(cmd)
result = `#{cmd}`
growl result rescue nil
end
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@schurpf
schurpf / .gitignore
Last active August 29, 2015 14:18 — forked from salcode/.gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore