Skip to content

Instantly share code, notes, and snippets.

View Leoche's full-sized avatar
💫
Set your status

Leoche Leoche

💫
Set your status
View GitHub Profile
@Leoche
Leoche / Init.php
Created August 22, 2023 18:59
Adds multiple ressourceType compatibility to CKFinder 3.6.0
<?php
/*
* CKFinder
* ========
* https://ckeditor.com/ckfinder/
* Copyright (c) 2007-2021, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
@Leoche
Leoche / gist:db68c14b9df3c61b6b6d50e1bb84f67a
Last active January 9, 2023 15:42
kick.com get if streamer online
fetch(`https://kick.com/api/v1/channels/` + $streamer)
.then(res => res.json())
.then(data => {
console.log(data.livestream.is_live);
});
@Leoche
Leoche / sortby_direction.xml
Created March 22, 2022 18:02
Magento 2 - set default sort and
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="XXXXXXXXXXXXXX\ListProduct" name="XXXXXXXX">
<action method="setDefaultDirection">
<argument name="dir" xsi:type="string">desc</argument>
</action>
<action method="setSortBy">
<argument name="attribute" xsi:type="string">ca_quantity</argument>
</action>
@Leoche
Leoche / update.php
Created March 22, 2022 17:49
Magento 2 - Fastest way to update a product attribute
/* var $productAction \Magento\Catalog\Model\ResourceModel\Product\Action */
$productAction->updateAttributes([$product_id], ['my_attribute' => $my_attribute_value], $store_id);
@Leoche
Leoche / urlkey_duplicate.sql
Created March 22, 2022 17:15
Magento 2 - Get all duplicate Url keys
SELECT VALUE, COUNT(value) FROM `catalog_product_entity_varchar` WHERE `attribute_id` = 123 AND `store_id` = 0 GROUP BY VALUE HAVING COUNT(value) > 1
@Leoche
Leoche / unfollow-non-followers-twitter.js
Created March 14, 2022 12:35 — forked from jalbam/unfollow-non-followers-twitter.js
Code to stop following those ones who are not following you back on Twitter and keeping those you want or follow anyone you want, with certain filters (working in July 2019)
/*
Unfollow (stop following) those people who are not following you back on Twitter (or unfollow everyone if desired).
This will work for new Twitter web site code structure (it was changed from July 2019, causing other unfollow-scripts to stop working).
Instructions:
1) The code may need to be modified depending on the language of your Twitter web site:
* For English language web site, no modification needed.
* For Spanish language web site, remember to set the 'LANGUAGE' variable to "ES".
* For another language, remember to set the 'LANGUAGE' variable to that language and modify the 'WORDS' object to add the words in that language.
@Leoche
Leoche / export_product_mage2.sql
Created October 18, 2021 14:55
Basic product export Magento
SELECT e.entity_id AS 'id',
v1.value AS 'name',
e.sku,
d1.value AS 'price',
t1.value AS 'short_description',
t2.value AS 'description',
v2.value AS 'image',
v3.value AS 'thumbnail',
mg.value AS 'media_gallery',
cids.category_ids AS 'category_ids',
@Leoche
Leoche / MAGENTO2SNIP.php
Last active January 18, 2021 09:19
MAGENTO2SNIP.php
// Mage 2.4 log smth:
$writer = new \Laminas\Log\Writer\Stream(BP . '/var/log/path-info-logger.log');
$logger = new \Laminas\Log\Logger();
$logger->addWriter($writer);
$logger->info($observer->getData("request")->getPathInfo());
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Leoche
Leoche / audit_animated.svg
Created September 24, 2020 12:59
audit_animated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.