Skip to content

Instantly share code, notes, and snippets.

View clivewalkden's full-sized avatar
🤓
Focusing on @golang & @kubernetes

Clive Walkden clivewalkden

🤓
Focusing on @golang & @kubernetes
View GitHub Profile
@JeroenBoersma
JeroenBoersma / NGINX - Magento 2 Static files optimization.md
Last active April 10, 2024 14:26
NGINX - Magento 2 Static files optimization

Introduction

Because Varnish doesn't support SSL, most people choose a setup where Nginx SSL will forward all traffic to Varnish and Varnish will forward will forward the traffic it cannot handle back to nginx. Or worse, bind Varnish on port 80 and direct all traffic into Varnish. This will already degrade performance, because Varnish will purge more because static files are also taking up room in the cache.

Default configuration

Next up, the Nginx configuration of Magento will handle static files.

@clivewalkden
clivewalkden / queries.sql
Last active August 2, 2019 16:21
Useful Magento 2 Database queries
# Display the number of SKUs in a attribute set
SELECT eas.attribute_set_name, COUNT(cpe.sku)
FROM eav_attribute_set AS eas
LEFT JOIN catalog_product_entity AS cpe ON cpe.attribute_set_id = eas.attribute_set_id
WHERE entity_type_id = 4
GROUP BY eas.attribute_set_name
# To see if an email to a user has been successfulyy sent in the sales_order table and sales_shipment table
SELECT s.email_sent AS "Shipment Email Sent", o.email_sent AS "Order Email Sent", s.order_id
FROM sales_shipment AS s
filter:
paths: ["app/code/{vendor-name-goes-here}/*", "vendor/{vendor-name-goes-here}/*"]
excluded_paths:
- "vendor/{vendor-name-goes-here}/{module-name-goes-here}/*"
- "app/code/{vendor-name-goes-here}/{module-name-goes-here}/*"
- '*.min.js'
before_commands:
tools:
php_code_sniffer:
config: { standard: 'Zend,PSR-1,PSR-2' }
@kennwhite
kennwhite / Nginx_1.11_Mainline_Cent_6_7_Static_OpenSSL_1.1.sh
Last active July 22, 2019 01:55
RPM build Nginx 1.11.x with ALPN on CentOS 6/7 using static OpenSSL 1.1 (v 1.02+ required for http/2 support in Chrome)
# Based on CentOS7 fork of @smartmadsoft: https://gist.github.com/moneytoo/ab3f34e4fddc2110675952f8280f49c5
# "6" for CentOS6 or Amazon Linux, "7" for CentOS7
CENTVER="6"
OPENSSL="openssl-1.1.0-pre5"
NGINX="nginx-1.11.0-1"
yum clean all
# Install epel packages (required for GeoIP-devel)
#!/usr/bin/php
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See https://github.com/magento/magento2/blob/develop/COPYING.txt for license details.
*/
/**
* validate_m2_package.php - a script that checks a given M2 zip package to ensure
* it is structured correctly and has all the required files.
@outflux3
outflux3 / foxycart_xml_processor.php
Last active December 29, 2015 03:39
adapted modx foxycart script for processwire..
<?
/*
Title:
FoxyCart_Inventory
Description:
Uses FoxyCart.com's XML Data Feeds to modify Processwire data.
Version:
@arosenhagen
arosenhagen / magento-code-snippets.md
Last active April 8, 2024 09:21
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@leek
leek / _Magento1_DeleteTestData.md
Last active December 29, 2023 09:51
Magento 1 - Delete All Test Data

These set of scripts are for Magento 1. For Magento 2, see this Gist.