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 / tmbr-load-template.php
Last active March 29, 2016 20:08
Helper function for loading a template in WP with some arbitrary data passed to it
<?php
/**
* Allows the passing of variables to a template file when loaded. Should help
* to remove the need for unnecessarily putting data into the $_GLOBAL scope.
*
* Usage:
* // This example will expose two variables to the loaded template:
* // $type = 'Foo', and $url = '//example.com/test.jpg'
* tmbr_load_template( 'partials/map.php', array(
* 'type' => 'Foo',
@bigdawggi
bigdawggi / gist:a4eb094faa213c3a1297
Created March 25, 2015 23:52
Codeship Custom Deploy Script for WPEngine
# You must set up two environment variables:
# repoSlug = slug for WP Engine repository
# themeDir = path from the top of the repository, to the theme directory
git remote add production git@git.wpengine.com:production/${repoSlug}.git
git remote add staging git@git.wpengine.com:staging/${repoSlug}.git
cd ${themeDir}
npm install
npm install -g bower
bower install
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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