Skip to content

Instantly share code, notes, and snippets.

View accentinteractive's full-sized avatar

Accent Interactive accentinteractive

View GitHub Profile
@accentinteractive
accentinteractive / product_recall_query.sql
Created July 11, 2020 07:43
Sometimes a manufacturer issues a recall, for instance for a polluted food product. You can run this query to quickly retrieve all customers that bought and succesfully paid for a particular product in a certain period.
--
-- RECALL ACTION QUERY
--
-- Return a list of customers,
-- both logged in and not,
-- that purchased product X,
-- between dates Y and Z,
-- with an order status that indicates their payment was received.
SET @date_from = '2020-01-01';
SET @date_to = '2020-02-01';
@accentinteractive
accentinteractive / rsync_media.sh
Created July 11, 2020 07:41
This command line script will download the entire Magento 2 media folder in seconds, and exclude the dreaded cache and tmp folders. You can use it to download a media folder to your local filesystem or sync media folders between servers.
#!/usr/bin/env bash
# Download all media from the production server, except for cached files.
# SET VARIABLES HERE
# 1. SSH connection
SSH_PRIVATE_KEY="~/.ssh/YOURPRIVATEKEY"
SSH_PORT=22
SSH_USER="YOURUSER"
SSH_HOST="YOURSERVER.COM"
@accentinteractive
accentinteractive / dump_helper.php
Created October 5, 2012 07:09
dump_helper: functions to dump variables to the screen, in a nicley formatted manner
<?php
/**
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
* @author Joost van Veen
* @version 1.0
*/
if (!function_exists('dump')) {
function dump ($var, $label = 'Dump', $echo = TRUE)
{
// Store dump in variable
@accentinteractive
accentinteractive / generate.php
Created October 2, 2012 09:21
Create generic controllers, models, helpers, libraries and views in a default codeigniter setup.
<?php
/**
* Use this class to automatically generate files for Codeigniter.
* This is to be used specifically with the file setup such as used
* in the course Building a CMS with Codeigniter on tutsplus.com.
*
* Just place this in your appllication/controllers folder and run it.
* NOTE: the ENVIRONMENT constant has to be set to 'development' or the
* class will return a 404.
*