Skip to content

Instantly share code, notes, and snippets.

@trepmal
trepmal / change-network-admin-color-scheme.php
Last active December 10, 2018 21:08
Swap the Color Scheme between regular and Network admins. For WP3.8 (and beyond, probably)
<?php
// Plugin Name: Change Network Admin Color Scheme
if ( is_multisite() ) {
add_filter( 'style_loader_src', 'cnacs_intercept_admin_color', 10, 2 );
add_action( 'admin_color_scheme_picker', 'cnacs_network_admin_color_scheme_picker');
add_action( 'personal_options_update', 'cnacs_update_network_admin_option' );
add_action( 'edit_user_profile_update', 'cnacs_update_network_admin_option' );
}
@chartjes
chartjes / gist:6666003
Created September 23, 2013 02:51
Vim setup
I use Pathogen and have the following bundles installed:
~/.vim/bundle ᐅ ls -l
total 0
drwxr-xr-x 5 chartjes staff 170 1 May 22:53 closetag.vim
drwxr-xr-x 8 chartjes staff 272 1 May 22:54 ctrlp.vim
drwxr-xr-x 8 chartjes staff 272 1 May 22:54 nerdcommenter
drwxr-xr-x 6 chartjes staff 204 1 May 22:51 pb.vim
drwxr-xr-x 18 chartjes staff 612 1 May 22:54 powerline
drwxr-xr-x 8 chartjes staff 272 1 May 22:54 supertab
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@Viper007Bond
Viper007Bond / whatissoslow.php
Last active October 29, 2023 14:23
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@scribu
scribu / php-init.sh
Created November 12, 2012 16:35
Ubuntu PHP Dev Setup
#!/bin/bash
# LEMP
apt-get -y install nginx mysql-server php5-mysql php5-fpm
# extra php packages
apt-get -y install php5-cli php5-gd php5-curl php5-xdebug
# change user from www-data to scribu
sed -i 's/www-data/scribu/g' /etc/nginx/nginx.conf /etc/php5/fpm/pool.d/www.conf
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.