Skip to content

Instantly share code, notes, and snippets.

View palpalani's full-sized avatar

Palaniappan P palpalani

View GitHub Profile
@mbijon
mbijon / benchmark_wordpress_seo-auto-linker.php
Created September 18, 2012 08:57
Quick benchmarker for WordPress Plugin: SEO Auto Linker. For @danielbachhuber b/c it uses many preg_matches
<?php
/*
* Usage:
* 1. Paste into Debug Bar console and Run
* 2. Run it several times (just in case iTunes is running on your dev server)
*
* Benchmarking Alternatives:
* - Wrap the real SEO Auto Linker for wp-cli and replace the call to content()
* - Add this quick & dirty benchmark loop to Debug Bar
*
@jtallant
jtallant / jt-related-posts.php
Created September 7, 2012 22:26
Related Posts Function for WordPress
@willmot
willmot / wordpress.vcl
Created July 4, 2012 15:48
WordPress Varnish VCL
backend default {
.host = "127.0.0.1";
.port = "8444";
}
sub vcl_recv {
# Allow the back-end to serve up stale content if it is responding slowly.
set req.grace = 2m;
@krogsgard
krogsgard / woo-loop-image-wrap.php
Created June 29, 2012 03:51
WooCommerce insert wrapper around thumbnail images in loop
<?php
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
<?php
/**
* Section Menu
* Displays the subpages of the current section
*
* @author Bill Erickson
* @link http://www.billerickson.net/custom-secondary-menu
*/
function be_section_menu() {
@FlorianX
FlorianX / gist:1965541
Created March 3, 2012 10:51
dynamic loaded Zend ACL db model
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
DROP SCHEMA IF EXISTS `mydb` ;
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`users`
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
@GaryJones
GaryJones / functions.php
Created February 12, 2012 04:01 — forked from billerickson/functions.php
Genesis Grid Loop Advanced
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
<?php
add_filter( 'genesis_author_box', 'be_author_box', 10, 6 );
/**
* Author Box
*
*/
function be_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {
$output = '';
@ziadoz
ziadoz / awesome-php.md
Last active February 3, 2025 20:55
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.