Skip to content

Instantly share code, notes, and snippets.

Pete McWilliams petemcw

View GitHub Profile
@petemcw
petemcw / 2.2.10.patch
Created Oct 18, 2019
Template patch for Magento Open Source 2.2.10
View 2.2.10.patch
--- vendor/magento/module-backup/view/adminhtml/templates/backup//list.phtml 2019-09-19 15:52:44.000000000 -0500
+++ vendor/magento/module-backup/view/adminhtml/templates/backup//list.phtml 2019-10-17 17:37:00.000000000 -0500
@@ -7,4 +7,4 @@
<?= $block->getChildHtml('grid') ?>
<?= $block->getGridHtml() ?>
<?= $block->getDialogsHtml() ?>
-<?php
+
--- vendor/magento/module-bundle/view/base/templates/product/price/selection/amount.phtml 2019-09-19 15:52:44.000000000 -0500
@petemcw
petemcw / sphp
Created Oct 15, 2019
Simple script for changing Homebrew installed PHP versions
View sphp
#!/usr/bin/env bash
################################################################################
#
# MacOS Homebrew-based PHP version switcher.
#
################################################################################
# Define read-only script variables
# -------------------------------------------------------------------------------
declare -r SPHP_BREW_PREFIX="$(brew --prefix | sed 's#/#\\\/#g')"
@petemcw
petemcw / sphp.sh
Created Nov 19, 2018
Switch PHP versions script
View sphp.sh
#!/usr/bin/env bash
BREW_PREFIX=$(brew --prefix | sed 's#/#\\\/#g')
BREW_ARRAY=("5.6","7.0","7.1","7.2")
PHP_ARRAY=("php@5.6" "php@7.0" "php@7.1" "php@7.2")
PHP_INSTALLED_ARRAY=()
PHP_VERSION="php@$1"
PROFILE="/Users/prm/.zshrc"
# Has the user submitted a version required
@petemcw
petemcw / CustomerSessionCheck.php
Created Jul 13, 2018
Magento 2.x Is Customer Logged In?
View CustomerSessionCheck.php
<?php
namespace Petemcw;
use Magento\Customer\Model\Session;
class Customer
{
/**
* @var \Magento\Customer\Model\Session
@petemcw
petemcw / docker_instructions.md
Last active May 20, 2020
Mac OS X Docker Instructions using Dinghy
View docker_instructions.md

Docker Installation

A great way to get Docker running smoothly on OS X is to use the awesome project Dinghy. It is basically:

Docker on OS X with batteries included, aimed at making a more pleasant local development experience. Runs on top of docker-machine.

Some of the benefits are:

  • Faster volume sharing using NFS rather than built-in virtualbox/vmware file shares
  • Filesystem events work on mounted volumes
@petemcw
petemcw / install_magento.md
Last active Jun 15, 2017
Install Magento 2.0
View install_magento.md

Install Magento 2.0

Download the software

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install_dir>
cd <install_dir>

Web server Permissions

@petemcw
petemcw / local.xml
Last active Aug 29, 2015
Basic Magento Redis Configuration
View local.xml
<?xml version="1.0"?>
<!--
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition End User License Agreement
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
@petemcw
petemcw / gist:a3292cb65851ecfc0e26
Created Jun 10, 2014
Quick cheat sheet for merging two separate repositories while retaining commit history.
View gist:a3292cb65851ecfc0e26
#
# Basic process for merging two Git repositories while retaining commit history.
# - This seems to work pretty well for migrations to Pantheon
#
# Clone the repository that will be the final origin
git clone <repository_uri_1> <local_dir>
cd <local_dir>
# Add the second repository as a remote
@petemcw
petemcw / assets.nginxconf
Last active Jul 1, 2019
Drupal-specific Nginx Configuration
View assets.nginxconf
# FILE: /etc/nginx/conf.d/assets.conf
# Directives to send expires headers and turn off 404 error logging for Static assets
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpe?g|gif|png|ico|zip|pdf|t?gz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|swf|bmp|txt|rtf|md)$ {
access_log off;
log_not_found off;
expires max;
add_header Cache-Control public;
}
View .my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# Include all files from the config directory
#
You can’t perform that action at this time.