Skip to content

Instantly share code, notes, and snippets.

Scott Buchanan scottsb

Block or report user

Report or block scottsb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scottsb
scottsb / di.xml
Last active Aug 3, 2019
Quick Fix Module for Magento2 Issue #21299 (HEAD request returns 404)
View di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\Request\HttpMethodMap">
<arguments>
<argument name="map" xsi:type="array">
<item name="OPTIONS" xsi:type="string">\Magento\Framework\App\Action\HttpOptionsActionInterface</item>
<item name="GET" xsi:type="string">\Magento\Framework\App\Action\HttpGetActionInterface</item>
<item name="HEAD" xsi:type="string">\Magento\Framework\App\Action\HttpGetActionInterface</item>
<item name="POST" xsi:type="string">\Magento\Framework\App\Action\HttpPostActionInterface</item>
<item name="PUT" xsi:type="string">\Magento\Framework\App\Action\HttpPutActionInterface</item>
@scottsb
scottsb / php-fpm-status-table
Last active Jul 29, 2019
PHP-FPM Full Status as Table
View php-fpm-status-table
#!/usb/bin/env bash
# Update as needed:
# * Status page URL for php-fpm if not at http://127.0.0.1/status
# * Host header of website if required to match correct pool
# Columns (as of PHP 7.1):
# * pid
# * state
# * start time
@scottsb
scottsb / fix-description.md
Last active Jul 5, 2019
Patch for WooCommerce Auth.net DPM SHA2 Response Calculation
View fix-description.md

The WooCommerce Authorize.net DPM plugin (v.1.8.0) has a bug in the SHA2 response calculation, causing the following error to appear to customers when they enter invalid credit card information (as well as an email to the merchant admin email):

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

As a quick fix, open the file class-wc-authorize-net-relay-response-handler.php and search for this bit of code:

! empty( $data[ $hash_field ] )

And replace with this:

@scottsb
scottsb / m2-cache-cheat-sheet.md
Last active Aug 14, 2019
Magento 2 Cache Cheat Sheet
View m2-cache-cheat-sheet.md

Magento 2 Cache Cheat Sheet

This page lists what caches or directories you will need to clear to apply various types of changes. It is consolidated and adapted from the complete official documentation on directories and caches.

💁 If your development environment supports it, you are better off using Vinai's automatic cache cleaner. As of this writing, the primary reason why it might not work is if your code is hosted on a NFS share (common with Vagrant).

@scottsb
scottsb / component-library-generators.md
Last active Dec 8, 2017
Component Library Generators for Existing Site
View component-library-generators.md

Component Library Generators for Existing Sites

Goal

Identify a tool for generating a living component/pattern library that can be integrated alongside a pre-existing code base. Ideally should be able to generate static HTML as part of a Grunt/Gulp job.

Finalists

@scottsb
scottsb / pre-commit
Last active Jul 15, 2017 — forked from timsweb/pre-commit
Git hook to prevent committing xdebug_break() functions. Save as .git/hooks/pre-commit then chmod +x it. Submodules also have their own hooks folder: ".git/modules/submodule/path/here/hooks".
View pre-commit
#!/bin/sh
for FILE in `git diff --cached --name-only` ; do
# Check if the file contains 'debugger'
grep -qE '^[ \t]*xdebug_break()' $FILE
if [[ $? -eq 0 ]]
then
echo $FILE ' contains xdebug_break()! To commit retry with --no-verify'
exit 1
fi
@scottsb
scottsb / paypal-id-formats.md
Last active Nov 13, 2018
PayPal API ID Prefix Formats
View paypal-id-formats.md

PayPal API ID Prefix Formats

PayPal uses various prefixes to distinguish different types of unique IDs in their APIs, but these are not currently documented in a single place. This Gist seeks to bring that information together into a single place. If there is something missing, please reach out through one of the channels on my GitHub profile since GitHub doesn't send notifications on Gist comments.

Formats

@scottsb
scottsb / checklist.md
Created Feb 24, 2016
Data to Hand Off in Digital Agency Transition
View checklist.md
  • Credentials for site admin
  • Credentials for hosting environment
  • Credentials for domain registration & DNS
  • Admin access to any site analytics platforms
  • If the code is in version control, copy of full repository including metadata (so we can preserve commit history)
  • Explanation of how code is currently deployed to the server, including a copy of any scripts used
  • License keys & registration information for any platform third-party modules purchased
  • Any code or architecture documentation
  • List of any known outstanding defects or maintenance improvements needed
@scottsb
scottsb / fix-diffcase-images.sh
Last active Apr 19, 2019
Fix name of images in Magento whose names only vary by case (renaming them both in the filesystem and the database catalog). This is useful if media files need to pass through a case-insensitive filesystem, like a Mac.
View fix-diffcase-images.sh
#!/bin/bash
# Settings
SUFFIX=alt
MAGERUNCMD=magerun
# Sanity Checks
type $MAGERUNCMD >/dev/null 2>&1 || {
echo "ERROR: This script requires the command '$MAGERUNCMD' to be executable in the current path."
exit
@scottsb
scottsb / casesafe.sh
Last active Aug 19, 2019 — forked from Hais/workspace.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
View casesafe.sh
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/casesafe}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.casesafe.dmg.sparseimage}"
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-60g}"
You can’t perform that action at this time.