Skip to content

Instantly share code, notes, and snippets.

View steverobbins's full-sized avatar

Steve Robbins steverobbins

View GitHub Profile
create table trigger_execution_log (
id int not null auto_increment,
ran_at timestamp default current_timestamp,
trigger_name varchar(255) not null,
message varchar(255),
primary key (id)
);
DELIMITER $$
select
-- count(1) ,
o.entity_id
, o.increment_id
, o.created_at
, o.customer_email order_email
, concat(o.customer_firstname, ' ', o.customer_lastname) order_name
, o.store_name
, ab.region billing_region
, ab.fax billing_fax
@steverobbins
steverobbins / build-static-cache.py
Last active May 3, 2017 20:00
Generate static HTML files for a list of urls and the .htaccess rewrite rules for them.
#!/usr/bin/env python
import os
import urllib2
baseUrl='https://www.thompsontee.com/'
cacheDir='static_cache'
htaccessFile='htaccess'
urls={
@steverobbins
steverobbins / magentoSmartIndexCacheRefresh.sh
Last active July 11, 2017 04:31
A Magento 1 script that will only reindex and refresh caches that have been invalidated.
#!/bin/bash
# Smart Magento reindexing and cache clearing. Only indexes and caches that are
# invalidate are cleared. Place this file in your shell/ directory and make it
# executable: chmod +x magentoSmartIndexCacheRefresh.sh
#
# Before use it is recommended to consider your failures as a developer due to
# lack of ability to correctly update individual indexes and caches as records
# modified processed.
#
<?php
$files = glob('*');
$reports = array();
foreach ($files as $file) {
if (!is_numeric($file)) {
continue;
}
$time = filemtime($file);
select
q.entity_id
, q.created_at
, q.updated_at
, q.base_grand_total
, q.customer_id
, q.customer_email
, q.reserved_order_id
, o.increment_id actual_order_id
from mage_sales_flat_quote q
#!/bin/bash
MYSQL_RUNNING=0
function checkMysql {
/usr/sbin/service mysql status | grep Uptime
if [ "$?" == 0 ]; then
MYSQL_RUNNING=1
fi
}
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:microsoft-dynamics-nav/xmlports/x55036" xmlns:ns2="urn:microsoft-dynamics-schemas/codeunit/Malibu">
<SOAP-ENV:Body>
<ns2:ImportShipmentLines>
<ns2:request>
<ns1:ShipmentHdr>
<ns1:NAVOrderNo>1475776983</ns1:NAVOrderNo>
<ns1:MagentoOrderNo>1475776984</ns1:MagentoOrderNo>
<ns1:ShipMethod>USPS</ns1:ShipMethod>
<ns1:ShipAgent>Steve Robbins</ns1:ShipAgent>
<ns1:TrackingNumbers>1234,5678</ns1:TrackingNumbers>
<?php
ini_set('display_errors', 1);
define('MAX_WEIGHT', 25);
$tests = [
[
'input' => [
[
@steverobbins
steverobbins / 00-README.md
Last active August 30, 2016 18:46
Scripts to set up local Magento 1 environment after importing from prod.

mage-local.py

Installation

  • Clone/download of version of zettr that has this commit.
  • Symlink/move the executable/phar to ~/bin/zettr
  • Place mage-local.py inside of ~/bin/ (~/bin/ should already be in your shell $PATH)
  • chmod +x ~/bin/mage-local.py
  • Place mage-local.csv inside of ~/.config/zettr/