Skip to content

Instantly share code, notes, and snippets.

<?php
/*
+----------------------------------------------+
| |
| PHP apache log parser class |
| |
+----------------------------------------------+
| Filename : apache-log-parser.php |
| Created : 21-Sep-05 23:28 GMT |
| Created By : Sam Clarke |
@eriwen
eriwen / gist:188105
Created September 16, 2009 15:33
apache httpd performance settings
# Set expires header and Remove ETags
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$">
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
Header unset ETag
FileETag None
</FilesMatch>
# Set cache-control header
<FilesMatch "\.(ico|jpg|png|gif)(\.gz)?$">
Header set Cache-Control "public"
@artlung
artlung / sitemap.xml.php
Created October 14, 2009 21:42
Generate XML sitemap from list of urls
<?php
/**
*
* This is a quick way to turn a simple text file
* with a list of urls in a text file (sitemap-urls.txt)
* into a valid XML Sitemap:
* http://en.wikipedia.org/wiki/Sitemaps
* Put this file sitemap.xml.php and sitemap-urls.txt at
* the webroot http://example.com/sitemap.xml.php
// definition of trackEvent method on a global object
$3N = {
trackEvent : function(category, action, label, value){
if (typeof(pageTracker) == "object") pageTracker._trackEvent(category, action, label, value);
else if(typeof(_gaq) == "object") _gaq.push(['_trackEvent', category, action, label, value]);
}
};
@mgirouard
mgirouard / destroy-sample-data.php
Created October 1, 2010 02:02
A quick hack to destroy all sample data in an OpenCart catalog.
<?php
$options = getopt('p:');
$prefix = empty($options['p'])
? realpath('.')
: realpath($options['p']);
if (empty($prefix)) {
die("Bad prefix. Try again.\n");
}
@jgornick
jgornick / gist:606489
Created October 1, 2010 17:01
JS: Google Analytics Helper
/**
* Analytics Helper
*
* Include this script at the bottom of the body when you want to enable tracking outbound links.
*
* To enable outbound tracking, simply add rel="external" to your anchor.
*
* To enable event tracking, add rel="trackevent" to your anchor, then use the fragment
* identifier in the href to set your event params. An example href would look like:
* href="#te_category=Downloads&te_action=PDF&te_label=Document&te_value=Value"
@bainternet
bainternet / custom-cf7-tags.php
Created August 9, 2011 12:59
custom contact form 7 tags
<?php
//contact form 7 extras
//author email
wpcf7_add_shortcode('expert_email', 'wpcf7_expert_email_shortcode_handler', true);
function wpcf7_expert_email_shortcode_handler($tag) {
if (!is_array($tag)) return '';
$name = $tag['name'];
if (empty($name)) return '';
@wilr
wilr / event.tracking.js
Created August 26, 2011 03:54
Simple jQuery Helper for wrapping GA event tracking
(function($) {
/*
A simple helper plugin for wrapping Google Analytic event tracking
into sites through jQuery and HTML5 data attributes.
This assumes that you have used the standard configuration provided
by google for setting up Google Analytics and used the _gaq var for
storing the tracker.
Can track focus, activate, hover and click input methods but not key
@chrisguitarguy
chrisguitarguy / front.php
Created August 30, 2011 13:07
SEO Auto Linker Fix
<?php
class pmgSeoAutoLinkerFront
{
function __construct()
{
add_filter( 'the_content', array( &$this, 'content' ), 1, 1 );
}
function content( $content )
{
@adrienne
adrienne / adrienne-utilities.htaccess
Created October 4, 2011 20:47
A handy set of .htaccess declarations that I can pick and choose from for various projects
SetEnv APPLICATION_ENV development
SetEnv DEBUG_FIREPHP enabled
# Access in PHP:
# // Define application environment
# defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
# // Enable FirePHP for testing?
# defined('DEBUG_FIREPHP') || define('DEBUG_FIREPHP', (getenv('DEBUG_FIREPHP') ? getenv('DEBUG_FIREPHP') : 'disabled'));
Options All -Indexes
Options +FollowSymLinks