Skip to content

Instantly share code, notes, and snippets.

@DomPixie
DomPixie / magento-2-send-email-without-transport-builder-or-template-command-line.md
Created March 13, 2024 16:37
Magento 2 send email without transport builder or template command line
use Magento\Framework\Mail\TransportInterfaceFactory;
use Magento\Framework\Mail\Message;

[...]

    protected $mailTransportFactory;

    public function __construct(
@DomPixie
DomPixie / docker-wsl2-setup.sh
Created January 14, 2023 18:29 — forked from Athou/docker-wsl2-setup.sh
install docker in Debian 11/WSL2 without Docker Desktop
# install docker in Debian 11/WSL2
# uses systemd-genie since docker requires systemd but it's not available for WSL
# this is an alternative to Docker Desktop
# prerequisites
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ca-certificates curl wget gnupg lsb-release apt-transport-https
# systemd-genie requires dotnet runtime, add Microsoft repo
@DomPixie
DomPixie / server.maillog.sendmail.stats
Created December 7, 2022 16:58
server maillog sendmail stats
grep -h "status=sent" /var/log/maillog | cut -c-6 | awk '{c[$0] += 1} END {for(i in c){printf "%6s %4d\n", i, c[i]}}' | sort -k2
@DomPixie
DomPixie / .jsbeautifyrc
Created December 21, 2021 23:41 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
require([
'jquery',
'Magento_Customer/js/customer-data'
], function ($,customerData) {
'use strict';
$(document).on('submit', function (event) {
if (event.target.method.match(/post/i)) {
customerData.initStorage();
customerData.invalidate(['cart']);
customerData.invalidate(['customer']);
@DomPixie
DomPixie / magento-2-set-and-get-cookie
Created November 24, 2021 21:16 — forked from DominicWatts/magento-2-set-and-get-cookie
Magento 2 set and get cookie
@DomPixie
DomPixie / magento-2-custom-patch-via-composer
Created November 22, 2021 21:16 — forked from DominicWatts/magento-2-custom-patch-via-composer
Create magento 2 custom patch via composer
# Patcher
composer require cweagans/composer-patches
git add -f ./vendor/magento/module-catalog/Model/ResourceModel/Product.php
# Edit file in vendor e.g. ./vendor/magento/module-catalog/Model/ResourceModel/Product.php
mkdir ./patches
mkdir ./patches/composer
@DomPixie
DomPixie / git-delete-local-tags
Created November 22, 2021 21:16 — forked from DominicWatts/git-delete-local-tags
git delete local tags
# Delete a tag locally, then use git fetch to "get it back". If the tag doesn't exist on the remote, then it will remain deleted. Thus you need to type two lines in order:
git tag -l | xargs git tag -d
git fetch --tags
wget https://release.gitkraken.com/linux/gitkraken-amd64.deb
sudo dpkg -i gitkraken-amd64.deb
# default version in APT repo
sudo apt show php -a
# currently 7.3 2021
sudo apt-get update && sudo apt-get upgrade
sudo apt install php
sudo apt install software-properties-common
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list