Skip to content

Instantly share code, notes, and snippets.

@foozlereducer
foozlereducer / amazon_tag_rendered.js
Last active August 22, 2017 19:43
Amazon Tag Rendered
<div class="l-main track_event " id="main" data-event-tracking="outfit"></div><aside class="l-sidebar"><li id="pn_dfpad-2" class="track_event-0 widget widget_pn_dfpad"> <div id="gpt-bigboxtop" class="pn_dfpads adslot">
<script type="text/javascript">
jQuery( document ).ready( function() {
apstag.fetchBids({
slots: [{
slotID: 'gpt-bigboxtop',
sizes: [
[ 300,250 ], [ 300,251 ], [ 300,600 ], [ 300,601 ]
]
}]
@foozlereducer
foozlereducer / null-ad-slot.js
Created October 3, 2016 12:20
nulll ad slot
<!-- Needs to be the first ad rendered on the page -->
<div id="gpt-nulladslot" style='height:0; display:none;'>
<!-- Null Ad Slot for bug DAS-265-->
<script>
googletag.cmd.push(function() {
var gpt_nulladslot = googletag.defineSlot('null', [66, 6], 'gpt-nulladslot').addService(googletag.pubads());
googletag.display('gpt-nulladslot');
googletag.pubads().refresh( [ gpt_nulladslot ], {changeCorrelator: false} );
});
</script>
@foozlereducer
foozlereducer / install.php
Last active September 9, 2016 12:22
install.php mysql INNODB helper code
<?php
// found in: ci-build/wordpress-tests-lib/includes/install.php
// reference: https://core.trac.wordpress.org/ticket/34692
/**
* Shell function that returns the version of mysql regardless of using PDO or MySQLi
* @return string - the numbered version of mysql i.e 5.7.14
*/
function get_mysql_version() {
$output = shell_exec('mysql -V');
@foozlereducer
foozlereducer / A installation Process
Last active January 8, 2020 15:24
Sierra / El Capitain NGINX, PHP_FPM, FastCGI, SSH, WordPress, HTML setup
If reinstalling, the items preceded with (s) can be skipped on the reinstall
1) on your Mac open your terminal
2) Install Home Brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3) Install NGINX ( Webserver ): brew install nginx
4) (s) Install dnsmasq for local DNS and subdomains like oc.test:
~ The following commands will install dnsmasq, configure it to point all requests to the .test top-level domain to
our local machine, and make sure it starts up and runs all of the time.
~ brew install dnsmasq
~ cd $(brew --prefix); echo 'address=/.test/127.0.0.1' > etc/dnsmasq.conf
~ sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
@foozlereducer
foozlereducer / Device.php
Last active November 1, 2016 19:41
Unit testing training files
<?php
namespace Postmedia\Web\Utilities;
/**
* Is Device - Adapter classes for JetPack device handling
* @author Steve Browning
* @version 1.0 - basic wrappers with jetpack exists checks
*/
class Device {
<?php
// The path to the file written out from xdebug
$path_and_filename = '/usr/srv/www/data.txt';
// get the data written out from xdebug
$data = file_get_contents ( $path_and_filename );
// The path to our output file
$output_path_and_filename = '/usr/srv/www/output.txt';
// open the file
$fp = fopen( $output_path_and_filename, 'a' );
// append data to it.
<?php
/**
* Template Name: Ad Test 1
*
* @package PostMedia
*/
get_header();
// check to see if function exists before calling it
function mem( $key, $in_or_out = 'in' ) {
if ( ! isset( $this->mem_usage ) ) {
$this->mem_usage = array();
}
$this->mem_usage[ $key ] = array( 'memory' => memory_get_usage(), 'in or out' => $in_or_out );
}
function console_log_mem() {
if ( function_exist( 'wpl_update_option' ) ) {
return wlo_update_option( $this->unique_storage_key, wp_json_encode( $this->process_data( $data ) ) );
} else if ( function_exist( update_option ) {
return update_option( $this->unique_storage_key, wp_json_encode( $this->process_data( $data ) ) );
}
return false;
<?php
require_once __DIR__ . '/vendor/autoload.php';
WP_Mock::setUsePatchwork( false );
WP_Mock::bootstrap();