Skip to content

Instantly share code, notes, and snippets.

Alessandro Ronchi aleron75

View GitHub Profile
@aleron75
aleron75 / Config.php
Last active Aug 8, 2017
Set global config value in Magento 1
View Config.php
Mage::getConfig()->saveConfig(Bitbull_Multiwarehouse_Helper_Data::XML_PATH_GENERAL_ACTIVE, 1);
Mage::getConfig()->cleanCache();
@aleron75
aleron75 / 0_reuse_code.js
Created Sep 22, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aleron75
aleron75 / getip.sh
Created Sep 17, 2016
Get IP address on local network interface
View getip.sh
#!/bin/bash
ip addr show eno1 | grep -oPi 'inet \K[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
@aleron75
aleron75 / setup_db_status.sh
Created Aug 12, 2016
Bash script to get different exit codes upon the bin/magento setup:db:status command
View setup_db_status.sh
#!/bin/bash
# use --no-ansi to avoid color characters
message=$(bin/magento setup:db:status --no-ansi)
if [[ ${message:0:3} == "All" ]];
then
exit 0 # 0 not required being default exit code; used for clarity
else
exit 1
fi
@aleron75
aleron75 / product_count.php
Created Jun 10, 2016
Magento 2 - get product collection count via runtime
View product_count.php
<?php
try {
require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
echo $e->getMessage() . PHP_EOL;
exit(1);
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
@aleron75
aleron75 / composersize.sh
Last active Jan 17, 2018
Shell script to "composerize" a Magento module
View composersize.sh
#!/bin/bash
function help {
echo "Arguments:"
echo " package name"
echo " package description"
}
dir=$(pwd)
@aleron75
aleron75 / check_xml.sh
Created Jan 17, 2016
Validate all config.xml files to spot XML syntax errors
View check_xml.sh
find . -type f -name 'config.xml' -exec xmllint --noout {} \;
@aleron75
aleron75 / .bashrc
Created Nov 19, 2015
XEBUG on/off alias
View .bashrc
alias xdebugon='export XDEBUG_CONFIG="idekey=phpstorm-xdebug" && sudo mv /etc/php5/mods-available/xdebug.ini.no /etc/php5/mods-available/xdebug.ini && sudo service apache2 restart'
alias xdebugoff='sudo mv /etc/php5/mods-available/xdebug.ini /etc/php5/mods-available/xdebug.ini.no && sudo service apache2 restart'
@aleron75
aleron75 / heydidyoujusteditthecore.sh
Last active Aug 29, 2015
Checks whether Magento core files were changed against a vanilla installation
View heydidyoujusteditthecore.sh
#!/bin/bash
# Requirements: patchutils - Utilities to work with patches
# Credits: http://inchoo.net/magento/quickly-check-if-magento-core-files-are-modified/
if [ $# -ne 2 ]; then
echo "Usage:"
echo "heydidyoujusteditthecore.sh <default_sacred_core_folder> <clients_core_folder>"
exit 1
fi
default_sacred_core_folder="$1"
@aleron75
aleron75 / gitlog.sh
Created Jun 30, 2015
Decorated git log
View gitlog.sh
#!/bin/bash
git log --graph --decorate --pretty=oneline --abbrev-commit
You can’t perform that action at this time.