Skip to content

Instantly share code, notes, and snippets.

View tdgroot's full-sized avatar
🔌

Timon de Groot tdgroot

🔌
View GitHub Profile
@tdgroot
tdgroot / autodark.py
Created September 20, 2024 06:07
GNOME automatic dark mode
#!/usr/bin/env python3
import gi
from gi.repository import Gio
import datetime
import json
import os
import requests
--- view/frontend/web/js/block-submit-on-send.orig.js 2020-11-19 12:44:54.544000000 +0100
+++ view/frontend/web/js/block-submit-on-send.js 2020-11-19 12:45:18.409967078 +0100
@@ -14,9 +14,15 @@
dataForm.submit(function () {
$(this).find(':submit').attr('disabled', 'disabled');
+
+ if (this.isValid === false) {
+ $(this).find(':submit').prop('disabled', false);
+ }
--- a/Block/Product/ProductsList.php
+++ b/Block/Product/ProductsList.php
@@ -8,6 +8,7 @@
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Block\Product\AbstractProduct;
+use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Block\Product\Widget\Html\Pager;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
@tdgroot
tdgroot / fix_varnish_missing_topmenu_github_3421.patch
Created June 10, 2020 07:06
Apply using cweagans/composer-patches, patch it for package magento/module-theme!
--- view/frontend/layout/default.orig.xml 2020-06-10 09:03:29.889000000 +0200
+++ view/frontend/layout/default.xml 2020-06-10 09:03:36.624645526 +0200
@@ -70,7 +70,7 @@
<arguments>
<argument name="title" translate="true" xsi:type="string">Menu</argument>
</arguments>
- <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" ttl="3600" before="-"/>
+ <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" before="-"/>
</block>
<block class="Magento\Framework\View\Element\Text" name="store.links" group="navigation-sections">
--- Model/Config.php 2020-04-23 08:56:42.000000000 +0200
+++ Model/Config.php 2020-05-15 16:28:16.337488649 +0200
@@ -822,6 +822,10 @@
$fullAttributeData = array_key_exists('is_required', $attributeData);
if ($existsFullAttribute || (!$existsFullAttribute && !$fullAttributeData)) {
+ $scopeIsRequired = $attributeData['scope_is_required'] ?? null;
+ if ($scopeIsRequired !== null) {
+ $attribute->setData('scope_is_required', $scopeIsRequired);
+ }
@tdgroot
tdgroot / catalog_graphql_image_size.patch
Created April 10, 2020 16:18
Add size to Magento_CatalogGraphQl MediaGallery Url field
--- etc/schema.orig.graphqls 2020-01-10 06:20:38.000000000 +0100
+++ etc/schema.graphqls 2020-04-10 18:07:05.630098596 +0200
@@ -197,7 +197,7 @@
}
interface MediaGalleryInterface @doc(description: "Contains basic information about a product image or video.") @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\MediaGalleryTypeResolver") {
- url: String @doc(description: "The URL of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Url")
+ url(width: Int, height: Int): String @doc(description: "The URL of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Url")
label: String @doc(description: "The label of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Label")
}
@tdgroot
tdgroot / MAGENTO_27311.patch
Created March 17, 2020 11:01
Magento 2.3 patch for pull request magento/magento#27311
--- view/base/web/js/form/element/date.orig.js 2019-09-19 12:30:58.000000000 +0200
+++ view/base/web/js/form/element/date.js 2020-03-17 11:51:49.691288844 +0100
@@ -111,21 +111,19 @@
* Prepares and sets date/time value that will be displayed
* in the input field.
*
- * @param {String} value
+ * @inheritDoc
*/
- onValueChange: function (value) {
--- a/Plugin/Block/Topmenu.php
+++ b/Plugin/Block/Topmenu.php
@@ -193,4 +193,21 @@ protected function getCategoryTree($storeId, $rootId)
return $collection;
}
+
+ /**
+ * Add active
+ *
@tdgroot
tdgroot / disable_unused_magento2_modules.sh
Last active January 11, 2021 11:27
Disable unused Magento 2 modules
#!/bin/bash
bin/magento module:status | \
grep -E '(Magento_(Adobe|Inventory|Braintree|Signifyd|Fedex|Marketplace|Authorizenet.*|.*GraphQl.*|.*Analytics)|Temando_|Amazon_|Dotdigitalgroup_|Vertex_|Klarna_)' | \
grep -v Magento_GoogleAnalytics | \
xargs bin/magento module:disable