Skip to content

Instantly share code, notes, and snippets.

@DominicWatts
DominicWatts / css-equal-heights.css
Last active March 24, 2023 16:24
css equal heights
/* Set a height */
/* Ellipsis to one line text */
.equal {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
/* Ellipsis to multiline text */
@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 / elasticsearch-cheatsheet
Created November 22, 2021 21:15 — forked from DominicWatts/elasticsearch-cheatsheet
Elasticsearch Cheatsheet
http://magento2.docker:9200/
http://magento2.docker:9200/_cluster/health
http://magento2.docker:9200/_cat/nodes?v&pretty
http://magento2.docker:9200/_cat/indices?v&pretty
curl -s -X GET "magento2.docker:9200/[indice]/_search?q=sku:ABC123"
curl -s -X GET "127.0.0.1:9200/[indice]/_search?q=sku:ABC123"
curl -s -X GET "magento2.docker:9200/_cat/indices?v&pretty"
curl -s -X GET "magento2.docker:9200/_cat/nodes?v&pretty"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --version=1.10.17 --install-dir=/usr/bin --filename=composer
php -r "unlink('composer-setup.php');"
composer --version
Composer version 1.10.17 2020-10-30 22:31:58
whereis composer
@DomPixie
DomPixie / kill-magento-processes
Created November 22, 2021 21:13 — forked from DominicWatts/kill-magento-processes
kill-magento-processes
kill -9 $(ps -aux | grep 'bin/magento' | grep -v grep | awk '{print $2}')
@DomPixie
DomPixie / Check-IP-on-server
Created November 22, 2021 21:13 — forked from DominicWatts/Check-IP-on-server
Check IP on server
Check IP address
curl
curl -s checkip.amazonaws.com
curl -s ipv4.icanhazip.com
curl -s http://ipv4.icanhazip.com
curl -s http://ipv6.icanhazip.com
curl -s https://checkip.amazonaws.com
@DomPixie
DomPixie / Magento-2-Superglobals-Get-PostParameters-Session
Created November 22, 2021 21:11 — forked from DominicWatts/Magento-2-Superglobals-Get-PostParameters-Session
Magento 2 Superglobals Get & Post Parameters + Session
<?php
/*
* Controller
*/
// $_SERVER
$this->getRequest()->getServer('SERVER_NAME');
@DomPixie
DomPixie / quick-php-info
Created November 22, 2021 21:11 — forked from DominicWatts/quick-php-info
Quick php info
echo '<?php phpinfo(); ?>' > ~/public_html/xinfo.php
rm ~/public_html/xinfo.php
@DomPixie
DomPixie / mysql-copy-table-syntax
Created November 22, 2021 21:11 — forked from DominicWatts/mysql-copy-table-syntax
mysql copy table syntax
CREATE TABLE IF NOT EXISTS new_table LIKE existing_table;
INSERT new_table SELECT * FROM existing_table;
@DomPixie
DomPixie / PHP-Compatibility-PHPCS-docker
Created November 22, 2021 21:10 — forked from DominicWatts/PHP-Compatibility-PHPCS-docker
PHP Compatibility PHPCS docker
docker run --rm -v $PWD:/code:ro domw/phpcompatibility phpcs --standard=PHPCompatibility --runtime-set testVersion 5.6-7.3 --colors --warning-severity=0 --report=full,summary --extensions=php,phtml ./