Skip to content

Instantly share code, notes, and snippets.

@WPsites
WPsites / gist:4563990
Created January 18, 2013 11:16
The WordPress Category Icons plugin had problems with incorrect paths when used on a non standard WordPress setup, which I've fixed in this code http://wordpress.org/support/plugin/category-icons
<?php
/*
Plugin Name: Category Icons
Plugin URI: http://www.category-icons.com/
Description: Easily assign icons to your categories. (Minimum WP version : 2.8)
Version: 2.2.3
Author: Brahim Machkouri
Author URI: http://www.category-icons.com/
Text Domain: category_icons
Domain Path: /languages/
<?php
/*
Plugin Name: Remove Update Nag
Description: Remove WordPress update nag as not needed
*/
add_action('after_setup_theme','remove_core_updates');
function remove_core_updates()
{
if(! current_user_can('update_core')){return;}
@WPsites
WPsites / gist:4232931
Created December 7, 2012 12:19
Logstash config test - failing!
input {
<% if node['logstash']['server']['inputs'].empty? -%>
tcp {
type => "tcp-input"
port => "5959"
format => "json_event"
}
<% else -%>
<%= LogstashConf.section_to_str(node['logstash']['server']['inputs']) %>
<% end -%>
@WPsites
WPsites / gist:4193981
Created December 3, 2012 09:56
Opscode Chef logstash cookbook - filters.json - WIP
"filters": [
{
"grok": {
"type": "syslog",
"pattern": [
"<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{PROG:syslog_program}(?:[%{POSINT:syslog_pid}])?: %{GREEDY$
],
"add_field": {
"received_from",
"%{@source_host}"
@WPsites
WPsites / gist:3935417
Created October 22, 2012 23:21
WPMU Gravity Form functions.php
<?php
/*
Filter the gravity form shortcode output to retreive the form from the main site
*/
add_filter('gform_shortcode_form', 'gform_shortcode_form_mu_override',10,3);
function gform_shortcode_form_mu_override( $shortcode_string, $attributes, $content ){
@WPsites
WPsites / gist:3490133
Created August 27, 2012 16:31
Apache + APC opcode cache : subsequent request for a soft linked PHP file (it's coming from the opcode cache)
accept(3, {sa_family=AF_INET, sin_port=htons(44640), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995218, 826638}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995218, 826856}, NULL) = 0
gettimeofday({1345995218, 826937}, NULL) = 0
gettimeofday({1345995218, 827007}, NULL) = 0
read(15, "GET /simon-soft2.php HTTP/1.0\r\nX"..., 8000) = 1374
@WPsites
WPsites / gist:3490122
Created August 27, 2012 16:30
Apache + APC opcode cache : initial request for a soft linked PHP file (symlink)
accept(3, {sa_family=AF_INET, sin_port=htons(39290), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995403, 39206}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995403, 39418}, NULL) = 0
gettimeofday({1345995403, 39492}, NULL) = 0
gettimeofday({1345995403, 39557}, NULL) = 0
read(15, "GET /simon-soft2.php HTTP/1.0\r\nX"..., 8000) = 1374
@WPsites
WPsites / gist:3490094
Created August 27, 2012 16:28
Apache + APC opcode cache : subsequent request for a hard linked PHP file (it's coming from the opcode cache)
accept(3, {sa_family=AF_INET, sin_port=htons(44590), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995128, 111295}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995128, 111533}, NULL) = 0
gettimeofday({1345995128, 111612}, NULL) = 0
gettimeofday({1345995128, 111682}, NULL) = 0
read(15, "GET /simon-hard.php HTTP/1.0\r\nX-"..., 8000) = 1373
@WPsites
WPsites / gist:3490077
Created August 27, 2012 16:26
Apache + APC opcode cache : initial request for a hard linked PHP file
accept(3, {sa_family=AF_INET, sin_port=htons(39263), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995352, 860155}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995352, 860364}, NULL) = 0
gettimeofday({1345995352, 860438}, NULL) = 0
gettimeofday({1345995352, 860504}, NULL) = 0
read(15, "GET /simon-hard.php HTTP/1.0\r\nX-"..., 8000) = 1373
@WPsites
WPsites / gist:2820551
Created May 28, 2012 18:35
If you use the _s starter theme from automattic you can enter these commands to replace _s with your theme name
# Search for:'_s', Replace with:'yourthemename' (text domain)
find . -type f \( -iname "*.php" -o -iname "*.css" -o -iname "*.txt" \) -exec sed -i "" "s/\'_s\'/\'yourthemename\'/g" '{}' \;
# Search for:_s_, Replace with:yourthemename_ (function names)
find . -type f \( -iname "*.php" -o -iname "*.css" -o -iname "*.txt" \) -exec sed -i "" "s/_s_/yourthemename_/g" '{}' \;
# Search for: _s, Replace with: Yourthemename (in comments)
find . -type f \( -iname "*.php" -o -iname "*.css" -o -iname "*.txt" \) -exec sed -i "" "s/ _s/ Yourthemename/g" '{}' \;
# Don't remove the space in ' Yourthemename'