Skip to content

Instantly share code, notes, and snippets.

View jag1989's full-sized avatar

Jonathan Garrett jag1989

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@jag1989
jag1989 / 1-get-asset-path-list.bash
Last active June 19, 2018 13:39
Extract asset paths and delete unused
cd ~/www/mduk/htdocs && find assets -type f > ./asset-paths-source-test.txt
count=$(wc -l < ~/www/mduk/htdocs/asset-paths-source-test.txt)
echo "Created ~/www/mduk/htdocs/asset-paths-source-test.txt"
echo "Total Asset Paths: $count"
@jag1989
jag1989 / anything.twig
Created February 7, 2018 15:33
Twig available vars
{% for key, value in content %}
{{ key }} - {{ value }}
{% endfor %}
@jag1989
jag1989 / gfrom.php
Created August 25, 2017 14:17
GForm isSelected Issue
/**
* Returns the field inner markup.
*
* @since Unknown
* @access public
*
* @uses GF_Field_MultiSelect::is_entry_detail()
* @uses GF_Field_MultiSelect::is_form_editor()
* @uses GF_Field_MultiSelect::get_conditional_logic_event()
* @uses GF_Field_MultiSelect::get_tabindex()
@jag1989
jag1989 / search.sql
Last active July 7, 2017 13:04
WordPress Shortcode Search
select post.ID, meta.meta_value, post.post_content
from wp_postmeta as meta
inner join wp_posts as post
on meta.post_id = post.ID
where post.post_content
like '%[shortcode_name%'
or meta.meta_value
like '%[shortcode_name%'
and post.post_type != 'revision'
group by post.id
@jag1989
jag1989 / functions.php
Created June 22, 2017 13:30
WordPress REGEXP for meta_query key
function meta_query_key_compare( $query ) {
$meta_query = $query->get('meta_query');
if(empty($meta_query)) {
return;
}
$marker = '__tmp_marker__';
$rx = [];
@jag1989
jag1989 / Newsletter Subscribers
Last active September 4, 2015 09:47
Clear Magento Data
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE newsletter_problem;
TRUNCATE newsletter_queue;
TRUNCATE newsletter_queue_link;
TRUNCATE newsletter_queue_store_link;
TRUNCATE newsletter_subscriber;
TRUNCATE newsletter_template;
ALTER TABLE newsletter_problem AUTO_INCREMENT=1;
@jag1989
jag1989 / content-block-meta.php
Last active August 29, 2015 14:25
WordPress Static Blocks with WP Alchemy
<?php
global $post;
?>
<div class="banner_meta_control">
<p>[cblock slug="<?php echo $post->post_name; ?>"]</p>
</div>
@jag1989
jag1989 / WordPress SMTP Mailer
Created September 18, 2014 14:31
WordPress send mail via SMTP
add_action( 'phpmailer_init', 'configure_smtp' );
function configure_smtp( PHPMailer $phpmailer ){
$phpmailer->isSMTP(); //switch to smtp
$phpmailer->Host = 'localhost';
$phpmailer->SMTPAuth = false;
$phpmailer->Port = 25;
$phpmailer->Username = 'Username Here';
$phpmailer->Password = 'myemailpassword';
$phpmailer->SMTPSecure = false;
$phpmailer->From = "noreply@email.com";