Skip to content

Instantly share code, notes, and snippets.

View mattwiebe's full-sized avatar

Matt Wiebe mattwiebe

View GitHub Profile
@mattwiebe
mattwiebe / podbean-oembed.php
Created April 21, 2018 16:24
PodBean oEmbed support in WordPress
<?php
/**
* Add Support for PodBean Embed URLs in WordPress.
* Modified from https://core.trac.wordpress.org/ticket/31068#comment:12 to use newer oEmbed endpoint
*
* Just paste an episode URL on a line.
* @link https://core.trac.wordpress.org/ticket/31068#comment:12
* @see wp_oembed_get()
* @param $providers [array] Existing oEmbed Providers
* @return [array] Providers with custom additions
@mattwiebe
mattwiebe / checkPerf.js
Last active March 2, 2016 15:45
Check performance up to a certain point in the page's load, multiple times
/**
* To use: call the function at the point in the load you want to check performance for.
* The page will then reload for @var iterations times to provide multiple measures
*/
function checkPerf() {
var mean;
var iterations = 10;
var times = localStorage.getItem( 'perf' ) ? JSON.parse( localStorage.getItem( 'perf' ) ) : [];
times.push( performance.now() );
localStorage.setItem( 'perf', JSON.stringify( times ) );
curl -s https://typekit.com/api/v1/json/families/gkmg | jsonpretty
{
"family": {
"id": "gkmg",
"name": "Droid Sans",
"slug": "droid-sans",
"web_link": "http://typekit.com/fonts/droid-sans",
"browse_info": {
"capitals": [
"uppercase-lowercase"
@mattwiebe
mattwiebe / keybase.md
Created January 20, 2015 23:54
keybase verification

Keybase proof

I hereby claim:

  • I am mattwiebe on github.
  • I am mattwiebe (https://keybase.io/mattwiebe) on keybase.
  • I have a public key whose fingerprint is 4E08 5645 1F69 5D0A B0FA 2DF0 31C2 3ED8 EDEF 5823

To claim this, I am signing this object:

@mattwiebe
mattwiebe / filter-out.php
Last active December 15, 2015 18:09
Filter out posts according to permissions and categories
<?php
add_action( 'pre_get_posts', 'mw_post_limiter' );
function mw_post_limiter( $wp_query ) {
// only modify for the main query - if we're not there, bail.
if ( ! $wp_query->is_main_query() )
return;
// category_slug => permission
$filtration_pairs = array(
jQuery( document ).ready( function( $ ) {
// Local vars.
var $masthead = $( '#masthead' ),
timeout = false,
$siteInfoClone,
$headerImageClone,
$socialLinksClone,
ajaxRequest = false,
$clickedModule;
@mattwiebe
mattwiebe / exclude-cat.php
Created June 26, 2012 23:40
exclude category from home
<?php
function mw_exclude_cat_from_home( $query ) {
// this is the category ID(s) you want to exclude.
$to_exclude = array( 3 );
if ( $query->is_main_query() && $query->is_home() ) {
$query->set( 'category__not_in', $to_exclude );
}
}
add_action( 'pre_get_posts', 'mw_exclude_cat_from_home' );
@mattwiebe
mattwiebe / disable-twitter-embeds.php
Created June 14, 2012 15:50
Disable Twitter Embeds
<?php
/*
Plugin Name: Disable Twitter Embeds
Description: Disables the Twitter embeds introduced in WordPress 3.4
Version: 1.0
Author: Matt Wiebe
Author URI: http://mattwiebe.wordpress.com/
*/
@mattwiebe
mattwiebe / of-italics.php
Created March 24, 2012 14:54
Options Framework Italics checkbox
<?php
/*
Plugin Name: Options Framework Italics
Plugin URI: http://somadesign.ca/
Description: Add dedicated italics checkbox to the Options Framework typography fields.
Version: 0.1
Author: Soma Design
Author URI: http://somadesign.ca/
License: GPL v2
@mattwiebe
mattwiebe / highlight-scheduled-posts.php
Created February 23, 2012 17:53
Highlight Scheduled Posts
<?php
/*
Plugin Name: Highlight Scheduled Posts
Plugin URI: http://somadesign.ca/
Description: Highlight scheduled posts in the admin
Version: 0.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/