Skip to content

Instantly share code, notes, and snippets.

View topdown's full-sized avatar
🎯
Focusing

Jeff Behnke topdown

🎯
Focusing
View GitHub Profile
@topdown
topdown / BrightCove Analytics JS API
Created June 11, 2014 17:42
BrightCove Analytics JS API required player params
FIND
<param name="dynamicStreaming" value="true" />
AFTER ADD
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="BCL.onTemplateLoaded" />
<param name="templateReadyHandler" value="BCL.onTemplateReady" />
Which should be before
<param name="@videoPlayer" value="some_video_id" / >
@topdown
topdown / vw_block_open_sans.php
Last active August 29, 2015 14:02
WordPress - Blocks Admin Panel from loading Google Fonts - Open Sans, mainly for work offline. I hate the lag when there is no internet.
<?php
/**
* Blocks Admin Panel from loading Google Fonts - Open Sans, mainly for work offline. I hate the lag when there is no internet.
*
* Created 6/21/14, 12:57 PM
*
* @category WordPress Plugin
* @package Block External Scripts - block_external_scripts.php
* @author Jeff Behnke <code@validwebs.com>
@topdown
topdown / wp-get-results.php
Created May 28, 2015 21:56
WP $wpdb->get_results() Gotcha
// Breaks ORDER BY silently
$sql = $this->wpdb->prepare( "SELECT * FROM $this->table ORDER BY 'id' ASC LIMIT %d OFFSET %d", $limit, $start );
// Works correctly
$sql = $this->wpdb->prepare( "SELECT * FROM $this->table ORDER BY id ASC LIMIT %d OFFSET %d", $limit, $start );
$rows = $this->wpdb->get_results( $sql );
return $rows;
@topdown
topdown / phpBB3.php
Created January 14, 2012 01:16
Fix code completion for phpBB3 in phpStorm
<?php
// Open phpBB3 root/common.php
// Add doc blocks above
$cache = new cache();
$db = new $sql_db();
// So they look like this
/** @var $cache acm */
$cache = new cache();
@topdown
topdown / example.php
Created January 14, 2012 01:09
WP PHPdocs for phpStorm
<?php
/**
* @see https://gist.github.com/1105126
*/
// Also some more hints and fixes
// WP functions for adding to the admin bar
// This will provide code completion for admin_bar functions like add_menu()
/** @var $wp_admin_bar WP_Admin_Bar */
@topdown
topdown / wp-gist.php
Created July 5, 2012 04:44
Gist URL in WP Post
<?php
/**
* This allows you to simply post a gist url in a WordPress 3.0+ post and it grabs the actual gist and displays it
* For example, if your having issues or don't allow posting of embedded javascript, which should not be allowed
*
* Put this code in your theme functions file
* then post a gist url on a new line
*
* https://gist.github.com/1697338
*
@topdown
topdown / menu-fix.html
Created July 5, 2012 09:01
WordPress embedded video hides drop menu fix
<script type="text/javascript">
/*
WordPress embedded video hides drop menu fix
Put this code in your header.php after wp_head(); and before </head>
It assumes you already have jQuery loaded
*/
jQuery(document).ready(function () {
jQuery('iframe').each(function () {
var url = jQuery(this).attr("src");
jQuery(this).attr("src", url + "&wmode=transparent");
@topdown
topdown / PSR-0-final-proposal.md
Created October 11, 2012 05:17 — forked from Thinkscape/PSR-0-final-proposal.md
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@topdown
topdown / provision.sh
Created December 3, 2015 05:08 — forked from FrankM1/provision.sh
Faster provisioning for vvv - Removed provisioning for Wordpress Core development. That took a long time to complete
#!/bin/bash
#
# provision.sh
#
# This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# or `vagrant reload` are used. It provides all of the default packages and
# configurations included with Varying Vagrant Vagrants.
# By storing the date now, we can calculate the duration of provisioning at the