Skip to content

Instantly share code, notes, and snippets.

View netconstructor's full-sized avatar
💭
pushing pixels

Christian Hochfilzer netconstructor

💭
pushing pixels
View GitHub Profile
@netconstructor
netconstructor / clean-debug.txt
Created May 1, 2012 10:48 — forked from boogah/clean-debug.txt
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>
@netconstructor
netconstructor / WP_Bag_of_Tricks.txt
Created May 1, 2012 10:52 — forked from boogah/WP_Bag_of_Tricks.txt
Things I've learned by being a WordPress nerd.
WP Bag of Tricks
1. Helpful Scripts/Plugins:
Hacks:
http://wordpress.org/extend/plugins/tac/
http://wordpress.org/extend/plugins/exploit-scanner/ (Can be extremely resource intensive.)
http://wordpress.org/extend/plugins/wp-malwatch/
@netconstructor
netconstructor / wp-modifydb.php
Created May 1, 2012 10:55 — forked from jcanfield/wp-modifydb.php
Serialized PHP Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@netconstructor
netconstructor / wp-multi-install
Created May 1, 2012 10:56 — forked from jhaus/wp-multi-install
install wordpress automatically via: http://codex.wordpress.org install wordpress automatic via: Installing_Multiple_Blogs#Multiple_Install_Automation
#!/bin/sh -x
# script by Stephanie Booth aka bunny http://stephanie-booth.com/ to install wordpress automatically (geeky, but useful for mass installs), with help from many people: drauh, io_error, zedrdave, roddie... and all those I've forgotten to mention.
# variables: $1 whatever, $2 wp_user, $3 wp_pass, $4 root password
# prerequisites: an existing mysql db, and a root password
# care! .htaccess is not generated, needs to be done manually, by clicking on "Update Permalinks" in Options once everything is installed
# todo: add themes, check plugin list, make wrapper script for multiple installs, prepare php patch template for options and common stuff, see if the script can edit the vhost conf files for mass installs, prepare alternate version for French, add bilingual plugin and maybe cache. Add an extra user to the WP install. Also an alternate version for upgrading the school blogs.
@netconstructor
netconstructor / wp-cdn.php
Created May 1, 2012 10:57 — forked from timwhitlock/wp-cdn.php
Simple tools for deploying Wordpress assets on a CDN
<?php
/**
Plugin Name: CDN Tools
Plugin URI: http://web.2point1.com/tag/wp-cdn
Description: Simple tool for deploying Wordpress assets on a CDN
Version: 0
Author: Tim Whitlock
Author URI: http://twitter.com/timwhitlock
*/
@netconstructor
netconstructor / index.php
Created May 1, 2012 10:59
Flexible WordPress install snippets
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
@netconstructor
netconstructor / gist:2567335
Created May 1, 2012 11:01 — forked from wycks/gist:2315279
Relative URLs in WordPress (hide wordpress)
<?php
function roots_root_relative_url($input) {
$output = preg_replace_callback(
'!(https?://[^/|"]+)([^"]+)?!',
create_function(
'$matches',
// if full URL is site_url, return a slash for relative root
'if (isset($matches[0]) && $matches[0] === site_url()) { return "/";' .
// if domain is equal to site_url, then make URL relative
@netconstructor
netconstructor / image-resize-crop.php
Created May 1, 2012 11:05 — forked from rbncha/image-resize-crop.php
Wordpress Image resize and crop function
<?php
/**
* This function is used to resize and crop image
* based on width from the center of the image
*
* creates new image from jpg,gif,png,bmp to png images
*/
function image_resize_crop ( $src, $w, $h, $dest = null, $override = false, $createNewIfExists = false ) {
$ext = array_pop ( explode ('.', $src) );
$filenameSrc = str_replace (".$ext", '', basename($src) );
@netconstructor
netconstructor / fixed-image-cropper.js
Created May 1, 2012 11:06 — forked from janfabry/fixed-image-cropper.js
WordPress Fixed Image Cropper
// pxi: pixels in image scale
// pxc: pixels in crop scale
// Helper function to create an element with optional attributes
// Doesn't jQuery already have this?
Monkeyman_FixedImageCroppper_createElement = function(tagName, attr)
{
if (!attr) {
attr = {};
}
@netconstructor
netconstructor / on-demand-resize.php
Created May 1, 2012 11:08 — forked from janfabry/on-demand-resize.php
WordPress On-Demand image resizer plugin (first public attempt)
<?php
/*
Plugin Name: On-Demand image resizer
Plugin URI: http://www.monkeyman.be
Description: Create and store images in different sizes on demand
Version: 1.0
Author: Jan Fabry
This plugins monitors 404 requests to the uploads directory and created new images of a requested size. They are saved as new files in the upload directory, not cached somewhere, so future requests are served directly by the server. This allows you to eliminate the creation of intermediate image sizes [see monkeyman-virtual-intermediate-images] or resize images based on the size used in the editor [see monkeyman-resize-image-tags].