Instantly share code, notes, and snippets.

View dropdownmove.js
// if the sub-navigation is off-screen we want to bump it left
const parentsli = document.querySelectorAll( 'ul > li.page_item_has_children' );
for ( let parent of parentsli ) {
const children = parent.querySelector( 'ul.children' );
parent.addEventListener( 'mouseenter', evt => {
// compare with width, to dropdown offset, to width of drop down
const windowWidth = document.documentElement.clientWidth;
View google-query-calendar.php
require_once ('/Google/autoload.php'); // see
require_once ('/Google/Service/Calendar.php');
$client = new Google_Client();
// $client settings and auth
$service = new Google_Service_Calendar($client);
$calendarId = '';
$optParams = array(
View functions.php
* Home Page Slideshow: add meta box to home page
add_action( 'add_meta_boxes', function () {
if (get_the_ID() !== intval(get_option('page_on_front'))) {
'Home Page SlideShow',
View wp-pass-php-into-js-alt.php
'var my_theme_data = %s;',
wp_json_encode( [
'nonce' => wp_create_nonce( 'wp_rest' ),
'path' => $path,
'blogname' => get_option( 'blogname' ),
View wp-pass-php-into-js.php
add_action( 'wp_enqueue_scripts', function () {
get_template_directory_uri() . '/my_app.js?=' . time(),
View section-sticky-buttons.css
#events {
overflow: hidden;
position: relative;
#events .show {
width: 30.3%;
background: white;
float: left;
padding: 150px 0;
margin: 20px 1.5%;
View wp-image-filters.php
// Images in post content and galleries
add_filter( 'get_post_galleries', 'myplugin_filter_image_url', 999999 );
add_filter( 'widget_media_image_instance', 'myplugin_filter_image_url', 999999 );
// Core image retrieval
add_filter( 'image_downsize', 'myplugin_filter_image_url', 10, 3 );
// Responsive image srcset substitution
View wp-fix-tax-query.php
global $wp_taxonomies;
$wp_taxonomies['my_missing_tax'] = 'delete';
// do `tax_query`'s in $new with `my_missing_tax`
View alfred-change-dev-pro.php
<?php // don't actually use the php in workflow
// get the result of Apple Script action
$url = '{query}';
$a = ['http:','.loc']; // dev
$b = ['https:','.com']; // production
// identify if production and invert if so
if (strstr($url,$b[1]))
tell application "System Events"
set myApp to name of first application process whose frontmost is true
if myApp is "Google Chrome" then
tell application "Google Chrome" to return URL of active tab of front window
else if myApp is "Opera" then
tell application "Opera" to return URL of front document
else if myApp is "Safari" then
tell application "Safari" to return URL of front document
else if myApp is "Firefox" then
tell application "System Events"