Skip to content

Instantly share code, notes, and snippets.

View vasilii-b's full-sized avatar
🙂

Vasilii Burlacu vasilii-b

🙂
View GitHub Profile
@vasilii-b
vasilii-b / validation.js
Created September 3, 2020 10:32
Magento 2 validate form fields on purpose
define([
'jquery',
'jquery/ui',
'mage/validation'
],
function (
$
) {
'use strict';
@vasilii-b
vasilii-b / cli-result-not-contain-text.sh
Created June 11, 2020 12:57
Search in CLI result for text not cantaining "XXX"
comand | grep -v "text"
@vasilii-b
vasilii-b / cli-two-folders-what-files-differ.sh
Created June 8, 2020 10:45
CLI command that shows what files differ compared into two folders
diff -qr porto porto_child | grep 'differ'
@vasilii-b
vasilii-b / cli-find-files-and-run-script-on-then.sh
Created April 20, 2020 14:02
Linux CLI: find filenames and execute a command on the files (without file extension)
#!/bin/bash
# get files without the extension
files=$(find ./ -name "filename*.html" -execdir basename {} .html \;)
for FILENAME in ${files}
do
#some-command-with-filename-as-param ${FILENAME};
done;
find {where} -name "{what-you-look-for}.{extension}" | wc -l
# `find {where} -name "{what-you-look-for}.{extension}"`
# looks for files by given name pattern
# and `wc -l` counts the result
@vasilii-b
vasilii-b / cli-rename-files-by-replacing-part-of-file-name.sh
Created April 17, 2020 17:52
Rename files with a regex in the file name
# if rename command no present
# sudo apt-get install rename
find -name '*.png' -type f -exec rename 's/word-to-replace-(.*\.png)/new-word-$1/' {} \;
@vasilii-b
vasilii-b / prepare-ubuntu-env-for-developer.sh
Last active April 8, 2020 19:51
A single command to prepare the desktop env. for development
#!/bin/bash
sudo apt-get update &&
sudo apt-get install vim &&
sudo apt-get install git &&
sudo apt-get install composer &&
sudo apt install zsh
@vasilii-b
vasilii-b / xdebug-not-working.sh
Created March 13, 2020 13:15
steps to perform and check why xdebug deosn't work
# look what services run on the default 9000 port
sudo lsof -i -n -P | grep 9000
# look what service run on that port and to stop it
brew services list
# stop the service
brew services stop [servicename]
@vasilii-b
vasilii-b / look-for-checkout-layout-change.sh
Last active February 11, 2020 12:12
Look what XML file changes the layout type for a page. Sometimes this is done without intention, but can break the store's desired layout. E.g. for the ckeckout page the default page layout is "checkout". When this get changed to "1column" magic happens.
# command below looks for `checkout_index_index.xml` files that changes the layout
grep -r -i --include \*checkout_index_index.xml "layout="
@vasilii-b
vasilii-b / m2-system-config-disable-admin-field.xml
Created November 18, 2019 13:19
Disable admin system config field | Magento 2
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="section-id">
<group id="group-id">
<field id="field-id" showInDefault="0" showInWebsite="0" showInStore="0" />
</group>
</section>
</system>