Skip to content

Instantly share code, notes, and snippets.

View markshust's full-sized avatar
🤓
Working on educational & training material for Magento 2

Mark Shust markshust

🤓
Working on educational & training material for Magento 2
View GitHub Profile
services:
app:
ports: !reset []
labels:
- "traefik.enable=true"
- "traefik.http.routers.magento-loc.tls=true"
- "traefik.http.routers.magento-loc.rule=Host(`magento.loc`)"
- "traefik.http.services.magento-loc.loadbalancer.server.port=8443"
- "traefik.http.services.magento-loc.loadbalancer.server.scheme=https"
networks:
@adamzero1
adamzero1 / README.md
Last active June 29, 2024 11:41
Get more descriptive error when DOM validation fails in Magento

Get a more debugable error message when DOM validation fails in Magento.

Original Error Message

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'arguments': This element is not expected.
Line: 1471
/**
* Run in the console to inline all code block styles before
* copy + pasting into ConvertKit in HTML mode
*/
const CSS_PROPERTIES = [
'background-color',
'font-size',
'color',
];
@zepgram
zepgram / AbstractPdf.php
Created June 17, 2022 13:43
PDF size reduction for Magento 2
<?php
declare(strict_types=1);
namespace MyNamespace\Sales\Model\Order\Pdf;
use Magento\Sales\Model\Order\Pdf\AbstractPdf as MagentoAbstractPdf;
/**
* Drastically reduce size of PDF by changing fonts
@levelsio
levelsio / git_graph.php
Last active June 5, 2023 03:49
GitHub style graph in PHP + CSS
<style>
.git-graph {
text-align: left;
line-height: 1;
}
.git-graph-row {
clear: both;
text-align: left;
}
.git-graph-cell {
@hostep
hostep / composer-v2-support-older-magento2-versions.md
Last active January 27, 2024 10:37
Add composer v2 support to older Magento2 versions

Add composer v2 support to older Magento2 versions

Magento 2.3.7 and 2.4.2 ship with composer v2 support out of the box but as far as I can see the only thing that needs to happen is to use some more modern versions of certain composer plugins which are used by certain dependencies of Magento.

This means we should be able to add composer v2 support to older Magento2 versions as well if we get a bit creative.

See below for diffs of the composer.json files you can apply to your projects, be sure to keep a mental note of these things, they will need to maintained by yourself in case newer versions of these modules are released. And if one day you update to Magento 2.3.7 or 2.4.2 or higher, you can remove these changes again.

⚠️ Disclaimer: use these tricks at your own risk!

// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@magenx
magenx / carding.sh
Last active September 8, 2024 10:39
#!/bin/bash
MAGE_BASE_URL="$1"
MAGE_SKU="$2"
PAYMENT_KEY="$3"
PAYMENT_METHOD="$4"
STORE_VIEW="$5"
CREDIT_CARD="$6"
CREDIT_CARD_CVC="$7"
@andyrbell
andyrbell / scanner.sh
Last active November 3, 2024 13:42
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@markshust
markshust / gist:c16c56525f55b71527f36faa4bd166ab
Created August 29, 2017 19:04 — forked from rogerclotet/gist:3901b03107437b247b03
Execute PHPUnit disabling xdebug
# Before using these aliases and function you must make a backup of your xdebug.ini
# (in this case /etc/php/conf.d/xdebug.ini.back)
# You will also need to be able to edit xdebug.ini
alias xdebug-disable='echo "" > /etc/php/conf.d/xdebug.ini'
alias xdebug-restore='cat /etc/php/conf.d/xdebug.ini.back > /etc/php/conf.d/xdebug.ini'
phpu() {
xdebug-disable
phpunit "$@"