Skip to content

Instantly share code, notes, and snippets.

Creating ...

Eric Mann ericmann

Creating ...
Block or report user

Report or block ericmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericmann
ericmann / gist:8929492
Created Feb 11, 2014
Allow Trash Posts
View gist:8929492
<?php
class My_Post_Work {
public function __construct() {
add_action( 'init', array( $this, 'custom_rewrites' ) );
add_filter( 'posts_results', array( $this, 'make_trash_public' ), 10, 2 );
add_filter( 'the_posts', array( $this, 'make_trash_private' ), 10, 2 );
}
View gist:d73806e773e1b1765af4

Ghost is an open source platform for blogging founded by John O'Nolan and Hannah Wolfe. It's a node.js application and therefore works great in conjunction with nginx. This guide will will help you create a high performance nginx virtual host configuration for Ghost.

"Don't use #nodejs for static content" - @trevnorris. If #nginx isn't sitting in front of your node server, you're probably doing it wrong.

— Bryan Hughes (@nebrius) August 30, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

The node.js application runs on a port on your server. We can configure nginx to proxy to this port and also cache so that we don't need to rely on express, the default n

View gist:296897ca4195afe4eca5
<?php
$query_timer = 0;
add_filter( 'do_parse_request', function( $parse ) {
global $query_timer;
$query_timer = microtime( true );
return $parse;
@ericmann
ericmann / autoloader.php
Created Apr 24, 2015
Simple autoloader for WordPress Must-Use plugins. The loader assumes plugins use the format `{plugin-name}\{plugin-name}`.php for their core file. If not, they're skipped.
View autoloader.php
<?php
/**
* MU-Plugin Autoloader
*
* @author Eric Mann <eric@eamann.com>
* @license MIT
* @copyright 2015 Eric Mann
*/
if ( ! defined( 'ABSPATH' ) ) {
View keybase.md

Keybase proof

I hereby claim:

  • I am ericmann on github.
  • I am eamann (https://keybase.io/eamann) on keybase.
  • I have a public key whose fingerprint is F7CA EACB D776 6264 C62E 0B32 9DC3 CED2 E6A0 7E86

To claim this, I am signing this object:

@ericmann
ericmann / Customfile
Created Aug 21, 2015
Hyper-V and Samba Customfile
View Customfile
config.vm.provider :hyperv do |v, override|
override.vm.box = "ericmann/trusty64"
end
config.vm.synced_folders.each do |id, options|
# Make sure we use SMB for file mounts on Windows
if ! options[:type] && Vagrant::Util::Platform.windows?
options[:type] = "smb"
end
end
@ericmann
ericmann / temp-testing-curl.php
Last active Aug 29, 2015
Temporary Test Code
View temp-testing-curl.php
/**
* Gets the PURL from the Friendbuy API.
*
* @param string e-mail address
* @returns object API Response
*/
function friendbuy_get_purl( $email ) {
// Verify param is actually an e-mail
if ( ! is_email( $email ) ) {
@ericmann
ericmann / gist:2591384
Created May 4, 2012
Non-parent theme psuedoframework
View gist:2591384

#Parent Themes There actually is nothing wrong with the parent/child theme model. I strongly believe that the only kind of theme that should ever be distributed is a parent theme - so clients/devs can create and modify a child theme on top of it.

But I have a problem with developing on top of a parent theme if the child theme is meant for general distribution. Child themes should never be re-sold or distributed.

If I'm planning to build a theme for release, starting with an existing parent theme and building a child theme is a really bad idea.

#Frameworks

Working with the popular theme frameworks is just an extension of this problem - i.e. using Genesis or Builder as a generic parent theme and building a custom design as a child theme on top of it.

@ericmann
ericmann / gist:2604547
Created May 5, 2012
Post meta wrapper
View gist:2604547
function get_meta_bool( $post_id, $key ) {
var $string_value = get_post_meta( $post_id, $key, true );
return (bool) $string_value
}
View gist:2765331
Set up images like this:
<div id="raffle">
<img src="..." data-link="http://link.url" />
<img src="..." data-link="http://link.url" />
</div>
Then set up a JS event listener:
jQuery('#raffle').on('click', 'img', function(e) {
You can’t perform that action at this time.