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 / check-db-size.sh
Last active March 3, 2023 07:56
Check database size on disk and see the table sizes with SQL
df -h | grep 'mysql\|Filesystem'
@vasilii-b
vasilii-b / Show database size.sql
Last active November 8, 2022 09:51
Magento 2 - Check database size
SELECT table_schema "Data Base Name",
SUM( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
SUM( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
@vasilii-b
vasilii-b / FormatPriceViewModel.php
Created January 17, 2022 10:10
Magento 2 View Model helpers
<?php
namespace ImaginationMedia\CaspianFrontend\ViewModel;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;
/**
* Class FormatPriceViewModel
*/
@vasilii-b
vasilii-b / grep-and-run-cli.sh
Created October 25, 2021 18:45
Grep and with result run command
bin/magento mod:st | grep SampleData | xargs -0 sh -c 'for name; do bin/magento mod:e $name; done' sh
@vasilii-b
vasilii-b / cli.sh
Created October 21, 2021 15:21
Change filename extension or replace part of filename
find ./ -name "*.css" -exec sh -c 'mv "$1" "${1%.css}.txt"' _ {} \;
@vasilii-b
vasilii-b / webpack.config.js
Created May 9, 2021 06:32
PWA Studio webpack server build show errors
const config = await configureWebpack({
[...]
devServer: {
stats: 'errors-warnings'
}
});
@vasilii-b
vasilii-b / magento2-setup-grunt.sh
Last active May 23, 2021 06:32
Magento 2 setup Grunt
#!/usr/bin/env bash
COLOR_HIHGLIGHT='\033[0;33m'
COLOR_NC='\033[0m'
printf "${COLOR_HIHGLIGHT}Installing Node.js and npm globally.${COLOR_NC}\n"
sudo apt-get update
sudo apt-get install nodejs npm
printf "${COLOR_HIHGLIGHT}Making sure npm uses SSL.${COLOR_NC}\n"
@vasilii-b
vasilii-b / collapsible-untill-breakpoint.js
Created May 5, 2021 08:07
Magento 2 Widget: Collapsible until breakpint
define([
'jquery',
'matchMedia',
'mage/collapsible'
], function($, mediaCheck) {
'use strict';
$.widget('collapsibleUntilBreakpoint', {
options: {
@vasilii-b
vasilii-b / project-config.php
Created February 14, 2021 12:04
Magento 2 - Enable theme from codebase.
<?php
// Project's config.php file
return [
'system'=> [
'default' =>[
'design' => [
'theme' => [
'theme_id' => 'frontend/vendor/theme-name', // theme name, as declared in registration.php
]
]
@vasilii-b
vasilii-b / install-latest-npm.sh
Last active August 18, 2021 08:50
Install latest version of Node.js (Linux, MacOS)
# if Node.js not yet installed
sudo curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
sudo bash n lts
# Now node and npm are available
sudo npm install -g n &&
sudo n stable &&
echo "Latest node was installed." &&
node -v