Skip to content

Instantly share code, notes, and snippets.

<?php
class ExceptionHook
{
public function SetExceptionHandler()
{
set_exception_handler(array($this, 'HandleExceptions'));
}
public function HandleExceptions($exception)
<?php
class PHPFatalError {
public function setHandler()
{
register_shutdown_function('handleShutdown');
}
}
function handleShutdown()
<?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') {
/**
* Bootstrap Walker for Wordpress Navigation Menu
*
* Extends WordPress walker class to add support for Twitter Bootstrap navigation menu and JS dropdowns.
* Caveats and features:
* - Only top level elements with children will be turned into dropdowns
* - Can be used in a Bootstrap nav but needs some CSS styling to improve presentation
* - With extra CSS multiple columns can be shown in a dropdown (sort of a simple mega-menu)
*
* Multi column dropdowns (mega-menu) via CSS:
@thecancerus
thecancerus / backup.sh
Last active September 24, 2019 04:49
Backup Script for WordPress to s3 using s3cmd
#!/usr/bin/env bash
# Back up Script to Amazon S3
# Source:
# Author: Amit
#path to WordPress installations
SITESTORE=/var/www
#S3 bucket
S3DIR="s3://bucket-name/"
@thecancerus
thecancerus / inc-db-backup.sh
Last active April 25, 2019 06:51
taking incremental backups
#!/usr/bin/env bash
# Back up Script to take Incremental Backups
# Source:
# Author: Amit
DAY=$(date +"%Y%m%d")
T=$(date +"%H%M")
MONTH=$(date +"%Y%m")
YEAR=$(date +"%Y")
#!/usr/bin/env bash
# Back up Script to Daily Full Backups
# Source:
# Author: Amit
DAY=$(date +"%Y%m%d")
MONTH=$(date +"%Y%m")
YEAR=$(date +"%Y")
YDAY=$(date -d '-1 day' '+%Y%m%d')
@thecancerus
thecancerus / prod-to-test.sh
Last active April 25, 2019 07:49
prod-to-test.sh
#!/usr/bin/env bash
# Back up Script to Amazon S3
# Source:
# Author: Amit
DATE=$(date +%Y%m%d%H%M)
LOGFILE=/var/log/prod-restore/$DATE.log
EMAIL=''
@thecancerus
thecancerus / psaux.sh
Last active April 25, 2019 06:56
monitor aux
#!/usr/bin/env bash
# Back up Script to Daily Full Backups
# Source:
# Author: Amit
DAY=$(date +"%Y%m%d-%H%M")
DAY2=$(date +"%Y%m%d")
DAY3=$(date +"%Y%m")
mkdir -p /var/log/psx/$DAY3/$DAY2
#!/usr/bin/env bash
# Back up Script to Amazon S3
# Source:
# Author: Amit
#path to WordPress installations
SITESTORE=/var/www
#S3 bucket
S3DIR="s3://<BUCKETNAME>/"