Skip to content

Instantly share code, notes, and snippets.

View jsoningram's full-sized avatar

Jason Ingram jsoningram

  • Orange County, CA
View GitHub Profile
{
"heading":
"Thank you for your interest in the MotorTrend / Hot Wheels<sup>®</sup> promotion!",
"logos": [
"https://mtg-mtod-production.s3-us-west-2.amazonaws.com/images/hotwheels-logo.png",
"https://mtg-mtod-production.s3-us-west-2.amazonaws.com/images/motortrend-logo-desktop-red.svg"
],
"messaging": {
"campaign.code.already.used":
"We are sold out at this time, but look for more opportunities in the future from us. In the meantime learn more about MotorTrend and subscribe to our streaming service by clicking <a href="/freetrial/">on this link</a>.",
@jsoningram
jsoningram / export-yoast-redirects.php
Created August 24, 2016 23:42
Export Yoast redirects to CSV file
<?php
$array = get_option('wpseo-premium-redirects');
foreach ( $array as $key => $row ) {
file_put_contents( ABSPATH . 'redirects.csv', $key . ',' . $row[ 'url' ] . "\n", FILE_APPEND );
}
@jsoningram
jsoningram / View_Variables.php
Created August 1, 2016 06:01
Better print_r and more flexible var_dump
<?php
class View_Variables {
public static function dump( $variables, $die = true ) {
if ( is_array( $variables ) ) {
foreach ($variables as $var ) {
var_dump( $var );
}
} else {
var_dump( $variables );
@jsoningram
jsoningram / post-type.sql
Created May 5, 2016 23:19
Delete posts by post type SQL
DELETE FROM `wp_posts`
WHERE `post_type` = 'posttype'
<?php
$plugin_dir = realpath( dirname( __FILE__ ) . '/..' );
$plugin = $plugin_dir . '/plugin.php';
register_activation_hook( $plugin, 'f2d_activation' );
function f2d_activation() {
if ( ! wp_next_scheduled( 'send_f2d' ) ) {
wp_schedule_event( time(), 'weekly', 'send_f2d' );
}
<?php
// write form submissions to text file.
// be sure to set permissions of text file to 750.
$leads = fopen('leads.txt', 'a') or die('Unable to process that request');
$txt = date(DATE_RFC2822);
$txt .= PHP_EOL;
$txt .= $body;
fwrite($leads, $txt . PHP_EOL . PHP_EOL);
fclose($leads);
$(document).ready(function() {
appendTooltipHoverListener();
removeDuplicateHeaders();
wrapDates();
});
var tooltip = new $.tooltip();
function onFilterSelected(val) {
for (var ctrlName in appCtrl.coverflow) {
<?php
$args = array(
'orderby' => 'id',
'hide_empty' => false,
'parent' => 0
);
$terms = get_terms( 'category', $args );
$cats = get_terms( 'category', $args );
$year = date( 'Y' );
@jsoningram
jsoningram / install-otto.md
Last active February 12, 2016 22:26
Install Hashicorp Otto

App

  • Wordpress
  • Roku
  • iOS
  • Android

Caching Layer

Cache third-party requests.