Skip to content

Instantly share code, notes, and snippets.

View davemac's full-sized avatar

davemac davemac

View GitHub Profile
@cogentParadigm
cogentParadigm / wordpress.php
Created March 20, 2010 03:33
Automated Wordpress Installer
#!/usr/bin/php
<?php
$usage = "Automated Wordpress installer\nby Ali Gangji\nUsage: wordpress install_dir -u dbuser -p dbpass -d dbname\nOptions:\n";
$usage .= " -u dbuser Database username\n";
$usage .= " -p dbpass Database password\n";
$usage .= " -d dbname Database name\n";
$usage .= " -h dbhost Database host\n";
$usage .= " --private Hide blog from search engines\n";
$usage .= " --prefix prefix Database prefix\n";
if ($argc < 2) {
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@franz-josef-kaiser
franz-josef-kaiser / future_core_login.php
Created November 10, 2010 23:52
A WordPress plugin to build an environment to develop a single stylesheet for the login/reg/pass screen in WP 3.1
<?php
/**
* Plugin Name: Future Core Login
* Plugin URI: http://unserkaiser.com
* Description: Replacing the current stylesheets loaded on wp-login.php until this ticket goes into core: <a href="http://core.trac.wordpress.org/ticket/12506">#12506</a>
* Version: 0.1
* Author: Franz Josef Kaiser
* Author URI: http://unserkaiser.com
* License: GPL2
*
@seedprod
seedprod / gist:1181262
Created August 30, 2011 16:11
WordPress Color Picker
<input type="text" name="my-theme-options[color]" id="color" />
<input type='button' class='pickcolor button-secondary' value='Select Color'>
<div id='colorpicker' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div>
// Color Picker for js file
$('.pickcolor').click( function(e) {
colorPicker = jQuery(this).next('div');
input = jQuery(this).prev('input');
$(colorPicker).farbtastic(input);
colorPicker.show();
@matiskay
matiskay / wp-install.sh
Created September 9, 2011 22:06
Wordpress Install
#!/bin/bash
if [[ ! -n $1 ]]; then
echo "Please insert a project name"
exit 1
fi
# Mysql Config
MYSQL_USER=""
@boogah
boogah / clean-debug.txt
Created September 10, 2011 21:44
Clean WordPress Debugging
Clean debugging:
// Add this to wp-config.php to cleanly debug a site.
// Just make sure to turn it off when you're done!
define('WP_DEBUG', true); // Turn debugging ON
define('WP_DEBUG_DISPLAY', false); // Turn forced display OFF
define('WP_DEBUG_LOG', true); // Turn logging to wp-content/debug.log ON
# Drop this in a .htaccess file in wp-content to keep the log safe.
<files debug.log>
@mjangda
mjangda / caching.php
Created September 29, 2011 04:42
Example of queries with and without caching
<?php
// == Without caching
$args = array( 'orderby' => 'comment_count', 'posts_per_page' => '1', 'ignore_sticky_posts' => 1 );
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
// do stuff
endwhile;
// == With Caching
// First, let's see if we have the data in the cache already
@billerickson
billerickson / gist:1325306
Created October 30, 2011 00:43
Display Post Image and Caption
<?php
/**
* Display Post Image and Caption
*
* @link http://www.billerickson.net/wordpress-featured-image-captions/
* @author Bill Erickson
*
*/
function be_display_image_and_caption() {
@3Easy
3Easy / ee_config.php
Last active August 4, 2017 08:40
Sample ExpressionEngine 2.x Config Files
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| ExpressionEngine Config Items
|--------------------------------------------------------------------------
|
| The following items are for use with ExpressionEngine. The rest of
| the config items are for use with CodeIgniter, some of which are not
| observed by ExpressionEngine, e.g. 'permitted_uri_chars'
@timcrider
timcrider / virtualhost.conf
Created November 23, 2011 20:54
Apache 'no reboot needed' virtual host configuration for development sites.
###############################################################################
#
# Apache virtual host 'no reboot needed' template.
#
# This apache virtualhost configuration allows a user to create development
# sites on the fly. This will not work out of the box however, you will need
# to replace the {variables} in this conf with values explained below. This
# can be done with a script, or a simple find and replace in your favorite
# editor.
#