Skip to content

Instantly share code, notes, and snippets.

View interactiveRob's full-sized avatar

Rob Kirkner interactiveRob

View GitHub Profile
@interactiveRob
interactiveRob / Example.js
Created January 14, 2022 16:01
Example ES6 Functional component
import { exists } from '@/helpers/utilities';
export let mixin = ({ node = null, config = {} } = {}) => {
if (!node) return false;
let state = {
node,
config,
};
@interactiveRob
interactiveRob / pardot-translate-link.html
Created January 5, 2022 19:53
Pardot translate Not You link on Landing Page form email field
@interactiveRob
interactiveRob / shave-images.sh
Created December 2, 2021 21:10
Command line terminal shave blank pixels off the edge of all images in directory
#requires imagemagick - https://imagemagick.org/script/command-line-processing.php
find *.jpg -exec convert {} -shave 1x1 {} \;
@interactiveRob
interactiveRob / setOverflowStyle.js
Created November 15, 2021 17:43
Javascript check text width exceeds container
function setOverflowStyle(bar) {
if (!exists(bar)) return;
let parts = bar.parts;
if (!parts.length) return;
[...parts].map((part) => {
let width = part.dataset.amount / this.total;
@interactiveRob
interactiveRob / passBtnClick.js
Created August 6, 2021 18:47
Javascript pass click to another button
function passClickToAnotherButton() {
/* HTML be like:
<button class="fake-button" send-click-to=".signature-m-pass">
Reserve now
</button>
*/
//get all the fake buttons
let buttons = Array.from(document.querySelectorAll('fake-button'));
@interactiveRob
interactiveRob / acf-get-fields-from-another-post.php
Created July 16, 2021 20:53
ACF get fields from Gutenberg block on another post
<?php
function rmk_get_block_from_post($post_id = null, $block_name =''){
$all_blocks = parse_blocks(get_the_content('', false, $post_id));
//handle global blocks
$ref_blocks = array_filter($all_blocks, function($block){
return isset($block['attrs']['ref']);
});
@interactiveRob
interactiveRob / dropdown-filter-custom-tax.php
Created July 9, 2021 12:25
WP Dashboard Admin Dropdown Filter Custom Post Type by Custom Taxononomy
<?php
function filter_representatives_by_taxonomies( $post_type, $which ) {
// Apply this only on a specific post type
if ( 'representatives' !== $post_type )
return;
// A list of taxonomy slugs to filter by
$taxonomies = array( 'company');
@interactiveRob
interactiveRob / wp-cli-delete-posts.sh
Created June 21, 2021 19:53
WP CLI delete all posts by post type
wp post delete $(wp post list --post_type='my_post_type' --format=ids) --force
@interactiveRob
interactiveRob / ga-conversion-track.js
Last active June 25, 2021 15:16
GA Conversion Tag Script with Conversion ID and Label
<!-- Event snippet for Example conversion page -->
<script>
gtag('event', 'conversion', {'send_to': 'AW-CONVERSION_ID/AW-CONVERSION_LABEL',
'value': 1.0,
'currency': 'USD'
});
</script>
<?php
$go_live_time = new DateTime('2021-7-1 6:00:00', new DateTimeZone('America/New_York'));
$current_time = new DateTime('America/New_York');
if($current_time < $go_live_time):
return;
endif;