This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function combos($data, &$all = array(), $group = array(), $val = null, $i = 0) { | |
if (isset($val)) { | |
array_push($group, $val); | |
} | |
if ($i >= count($data)) { | |
array_push($all, $group); | |
} else { | |
foreach ($data[$i] as $v) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function writeGif() | |
{ | |
header( 'Content-type: image/gif' ); | |
header( 'Expires: Wed, 11 Nov 1998 11:11:11 GMT' ); | |
header( 'Cache-Control: no-cache' ); | |
header( 'Cache-Control: must-revalidate' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// place and run in ./plugins/bbpress/bbp-themes | |
$dirs = array( './bbp-twentyten', './bbp-twentyten/bbpress' ); | |
$actions = array(); | |
$filters = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isArray( obj ) | |
{ | |
if ( Object.prototype.toString.call( obj ) === '[object Array]' ) return true; | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* actions fired when listing/adding/editing posts or pages */ | |
/* admin_head-(hookname) */ | |
add_action( 'admin_head-post.php', 'admin_head_post_editing' ); | |
add_action( 'admin_head-post-new.php', 'admin_head_post_new' ); | |
add_action( 'admin_head-edit.php', 'admin_head_post_listing' ); | |
function admin_head_post_editing() { | |
echo 'you are editing a post'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root = $_SERVER['DOCUMENT_ROOT']; | |
chdir( $root ); | |
$path = '/'.ltrim( parse_url( $_SERVER['REQUEST_URI'] )['path'],'/' ); | |
if ( file_exists( $root.$path ) ) | |
{ | |
if ( is_dir( $root.$path ) && substr( $path,strlen( $path ) - 1, 1 ) !== '/' ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PHP memory limit for this site | |
define( 'WP_MEMORY_LIMIT', '128M' ); | |
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
// Database | |
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
// Explicitely setting url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install x-related to compile x11vnc from source code. | |
sudo apt-get update | |
sudo apt-get install -y libxtst-dev libssl-dev libjpeg-dev | |
# Grep source code. | |
wget http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz | |
gzip -dc x11vnc-0.9.14-dev.tar.gz | tar -xvf - | |
cd x11vnc-0.9.14/ | |
./configure --prefix=/usr/local CFLAGS='-g -O2 -fno-stack-protector -Wall' |