Skip to content

Instantly share code, notes, and snippets.

View jedgalbraith's full-sized avatar

Jed Galbraith jedgalbraith

View GitHub Profile
@jedgalbraith
jedgalbraith / mysql_backup.sh
Last active December 17, 2015 12:58
pagoda cron commands for regular MySQL backups
# 'backups/' dir must exist previously.
# Removes backup files older than 7 days,
Command: find backups/* -mtime +7 -exec rm {} \;
# Every day at midnight
UNIX cron schedule: 0 0 * * *
# Creates backups in the 'backups/' writable directory.
Command: mysqldump -h $DB1_HOST -P $DB1_PORT -u $DB1_USER -p$DB1_PASS $DB1_NAME > backups/$DB1_NAME-"$(date +"%m_%d_%Y")".sql
# Every day at 1AM
@jedgalbraith
jedgalbraith / magento_product_attributes.sql
Created April 24, 2013 22:35
select all eav attributes associated with a product
SELECT
ce.sku,
ea.attribute_id,
ea.attribute_code,
CASE ea.backend_type
WHEN 'varchar' THEN ce_varchar.value
WHEN 'int' THEN ce_int.value
WHEN 'text' THEN ce_text.value
WHEN 'decimal' THEN ce_decimal.value
WHEN 'datetime' THEN ce_datetime.value
@jedgalbraith
jedgalbraith / gist:5217588
Last active December 15, 2015 06:39
example pagoda worker error handler
# First set the custom error handler at the beginning of the script:
# php docs: http://php.net/manual/en/function.set-error-handler.php
set_error_handler('workerErrorHandler');
# Next define the workerErrorHandler function:
function workerErrorHandler($errno, $errstr, $errfile, $errline)
{
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
@jedgalbraith
jedgalbraith / local.xml
Created August 15, 2012 18:49
Magento disable logs and reports
<frontend>
<events>
<!-- logs -->
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
<customer_login>