Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabrizio Balliano fballiano

View GitHub Profile
View gist:9d9852b4012db6b705dd5b57604e8419
protected function _applyInlineCss($html)
{
try {
// Check to see if the {{inlinecss file=""}} directive set a CSS file to inline
$inlineCssFile = $this->getInlineCssFile();
// Only run Emogrify if HTML exists
if (strlen($html) && $inlineCssFile) {
$cssToInline = $this->_getCssFileContent($inlineCssFile);
$processedHtml = \Pelago\Emogrifier\CssInliner::fromHtml($html)
->disableInlineStyleAttributesParsing()
View gist:9b9040355ec05c5e8a0c9377c15c8c13
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Core\ValueObject\PhpVersion;
View keybase.md

Keybase proof

I hereby claim:

  • I am fballiano on github.
  • I am fballiano (https://keybase.io/fballiano) on keybase.
  • I have a public key ASAIirs8qXvWrjUkyDF67MoeC38l2Fsv7J5b9AHTVmiS6go

To claim this, I am signing this object:

View magento-login-admin.php
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$user = Mage::getModel('admin/user')->loadByUsername('admin'); // Here admin is the Username
if (Mage::getSingleton('adminhtml/url')->useSecretKey()) Mage::getSingleton('adminhtml/url')->renewSecretUrls();
@fballiano
fballiano / magento2-province-italiane.sql
Last active Oct 8, 2015
Magento2 Province Italiane (da archivio ufficiale ISTAT, aggiornamento 02/08/2015).
View magento2-province-italiane.sql
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Agrigento','AG');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Alessandria','AL');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Ancona','AN');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Arezzo','AR');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Ascoli Piceno','AP');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Asti','AT');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Avellino','AV');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Bari','BA');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Barletta-Andria-Trani','BT');
INSERT INTO directory_country_region (country_id, default_name, code) VALUES ('IT','Belluno','BL');
View core_Mage_Sales_Model_Order_Pdf_Total_Default.php.patch
93c93,106
< $taxClassAmount = array_merge($taxClassAmount, $shippingTax);
---
> $_weees = Mage::helper('tax')->getAllWeee($this->getOrder());
> $wees = array();
> foreach ($_weees as $name => $value) {
> $wees[] = array(
> "tax_amount" => $value,
> "base_tax_amount" => $value,
> "title" => $name,
View delete-old-enterprise-staging-backups.php
<?php
require_once 'abstract.php';
class Shell_Delete_Old_Enterprise_Staging_Backups extends Mage_Shell_Abstract
{
public function run()
{
$actions = Mage::getModel("enterprise_staging/staging_action")->getCollection()
->addFieldToFilter("type", "backup")
@fballiano
fballiano / build.sh
Last active Apr 25, 2021
Ubuntu Mini Remix
View build.sh
#!/bin/bash
# user: ubuntu pass: just hit ENTER
apt-get install vim ubuntu-defaults-builder live-build uck syslinux-utils coreutils
# open /usr/share/livecd-rootfs/live-build/auto/config and add PROJECT=base where there are all the variables
ubuntu-defaults-template ubuntu-defaults-umr
ubuntu-defaults-image --package ubuntu-defaults-umr_0.1_all.deb
mv binary.hybrid.iso ubuntu-mini-remix-15.10-amd64.iso
md5sum ubuntu-mini-remix-15.10-amd64.iso>ubuntu-mini-remix-15.10-amd64.iso.md5
mv ubuntu-mini-remix-15.10-amd64.iso* 15.10/
@fballiano
fballiano / apply_promotion_rules.php
Created Jul 21, 2014
Apply promotion rules, for Magento EE 1.13, CE 1.8
View apply_promotion_rules.php
<?php
require_once 'app/Mage.php';
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try {
Mage::getModel('catalogrule/rule')->applyAll();
Mage::getModel('catalogrule/flag')->loadSelf()
@fballiano
fballiano / controller.php
Created Jul 17, 2014
Magento: controller bootstrapping layout and messages
View controller.php
public function indexAction()
{
$this->loadLayout();
$this->_initLayoutMessages("customer/session");
$this->_initLayoutMessages("catalog/session");
$this->renderLayout();
}