Skip to content

Instantly share code, notes, and snippets.

View evansolomon's full-sized avatar

Evan Solomon evansolomon

View GitHub Profile
@evansolomon
evansolomon / gist:3186427
Created July 27, 2012 06:11
Generic function to add body classes on the fly in WordPress
<?php
/**
* Generic function to add body classes
* Can take either a string of space-separated classes or an array
*
* Requires PHP 5.3 for access to closures
*/
function es_add_body_class( $new_classes ) {
// Turn the input into an array we can loop through
@evansolomon
evansolomon / gist:2274120
Created April 1, 2012 09:36
nginx WordPress multisite config
server {
listen 80 default_server;
server_name domain.com *.domain.com;
root /srv/www/domain.com/public;
access_log /srv/www/domain.com/log/access.log;
error_log /srv/www/domain.com/log/error.log;
location / {
index index.php;
@evansolomon
evansolomon / jetpack-subscribe.php
Created December 3, 2012 11:17
Custom signup form for Jetpack subscriptions
<?php
/*
Plugin Name: Jetpack Subscribe
Description: Custom subscription UI for Jetpack
Version: 1.0
Author: Evan Solomon
Author URI: http://evansolomon.me/
*/
class ES_Jetpack_Subscribe {
import Ember from 'ember';
export default Ember.Component.extend({
someData: 'hello'
didReceiveAttrs() {
console.log('didReceiveAttrs')
},
didUpdateAttrs() {
console.log('didUpdateAttrs')
}
@evansolomon
evansolomon / components.child-component.js
Created April 22, 2019 16:26
Subtle mutable data bug
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
clearPersonData() {
this.set('person', null)
}
}
});
@evansolomon
evansolomon / capitalize-category-names.php
Created June 13, 2012 08:11
Capitalize category names in WordPress
<?php
/*
Plugin name: Capitalize category names on display
Description: Capitalize the first letter of a category name when it's displayed in the theme
*/
function capitalize_category_names_on_display( $name ) {
return ucfirst( $name );
}
add_filter( 'single_cat_title', 'capitalize_category_names_on_display' );
@evansolomon
evansolomon / www.conf
Created April 1, 2012 09:10
PHP-FPM config
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
import Ember from 'ember';
export default Ember.Controller.extend({
contentHtml: Ember.String.htmlSafe(`
<p>Hello <strong>world</strong></p>
<p>This content has html like images</p>
<p><img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg"></p>
`)
});
@evansolomon
evansolomon / git-completion.sh
Created April 1, 2012 08:36
Git auto-complete script
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@evansolomon
evansolomon / optimizely.php
Created October 10, 2011 17:37
WordPress.com plugin for running Optimizely experiments
<?php
/*
Plugin Name: Optimizely
Description: Runs Optimizely experiments.
Author: koop, evansolomon
Version: 0.2
*/
class WPCOM_Optimizely {
public $version;