Skip to content

Instantly share code, notes, and snippets.

View bigdawggi's full-sized avatar

Matthew Richmond bigdawggi

  • Bigdawggi Co
  • Island Park, ID
View GitHub Profile
@bigdawggi
bigdawggi / wp-cli-active-themes-across-network
Last active February 16, 2023 05:54
WP-CLI commands to get the active themes across a WordPress blog network (single site ID with multiple blogs for the site)
# Be sure to change or omit the --network parameter; it defaults to 1.
wp site list --network=4 --field=url | while read line; do wp theme list --status=active --field=name --url=$line >> /tmp/wpcli-themes.txt; done && sort /tmp/wpcli-themes.txt | uniq -c
@bigdawggi
bigdawggi / index.js
Created October 19, 2022 21:39
JavaScript Bookmarklet for Adding a cookie to your current domain
javascript: (() => {
const COOKIE_NAME = 'FOOBAR';
const COOKIE_VALUE = 1;
/**
* Should we show the alert popup after setting the cookie?
*/
const SHOULD_ALERT = true;
var date = new Date();
date.setYear(date.getFullYear() + 1);
@bigdawggi
bigdawggi / composer.sh
Created May 19, 2021 23:30
Docker for Composer and Yarn
#!/bin/bash
# Go to script location
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
# Specify our version of node to run
composerVer="1.6.5"
# This is a little magic that makes it possible to forward an SSH agent into docker
@bigdawggi
bigdawggi / gist:bf29119292761239924b
Created February 3, 2015 22:28
Code to run WP Cron at midnight local time
if ( ! wp_next_scheduled( 'tmbr_daily_at_midnight_actions' ) ) {
$local_time_to_run = 'midnight';
$timestamp = strtotime( $local_time_to_run ) - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
wp_schedule_event(
$timestamp,
'daily',
'tmbr_daily_at_midnight_actions'
);
}
@bigdawggi
bigdawggi / AWS S3 Restricted Policies.md
Last active July 24, 2020 04:35
How to do restricted policies for programmatic (API) access to get/put objects into S3.

AWS being one of the most frustrating and difficult to use systems out there has to make everything difficult. This is something that has caused so much headache for me over the years, I'm starting to document it.

This README.md got me started, though didn't quite fit everything I needed.

Here's how you create Policies for a bucket

Assuming the following:

  1. You created a bucket named foo and that bucket has blocked all public access.
  2. You created a user named bar that was given API access (using keys and secrets).
@bigdawggi
bigdawggi / mailtrap-filter.php
Last active June 3, 2019 19:11
Mailtrap filter for WordPress
/**
* Routes all email from WP installation to specific Mailtrap
* account inbox.
*
* All you need to do is change the "Username" and "Password"
* settings to the appropriate box in Mailtrap. Then all
* mail **should** be routed to that box. Exceptions would
* be other functionality that overwrite the wp_mail() functions
* and may not use this filter, or other filters that change
* this behavior after we set it, or millions of other things.
@bigdawggi
bigdawggi / Outbound Link Tracking - Google Analytics.js
Created November 22, 2011 23:02
jQuery-based outbound link tracking with cases for new window as well as same window locations
@bigdawggi
bigdawggi / composer-notes.md
Created February 7, 2017 23:44
Composer: How to reference local git repo's branch for development.

APP'S COMPOSER.JSON

....
"repositories": [
    { "type": "git", "url": "../email-library" }
],
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.4.*",

"laravel/tinker": "~1.0",

@bigdawggi
bigdawggi / ffmpeg cheatsheet.mdown
Last active January 20, 2017 08:28
Quick cheatsheet for ffmpeg

Movie Conversions with ffmpeg

NOTE About Vimeo: Looks like they want 5M for bitrate - I think that'll mean, just switching the 2M to 5M in the commands below.

This video’s bit rate is only 1984 kbit/s, which is lower than what we recommend for H.264 video. Your video might not look as nice as it should. For 1280x720 video, we recommend a data rate of at least 5000 kbit/s. Learn more about our recommended compression settings.

Convert iMovie mp4 to webm

No audio...remove "-an" if you want audio

@bigdawggi
bigdawggi / gist:2474388
Created April 23, 2012 22:53
String Arrays to PHP arrays
<?php
echo '<pre>';
class string_array_parser {
function parse_string($key, $value) {
// no limit, no empty values in returned array
$splits = preg_split('[\[|\]]', $key, -1, PREG_SPLIT_NO_EMPTY);
// Get the first element, that will be the name of the actual meta key