Skip to content

Instantly share code, notes, and snippets.

@ericthehacker
ericthehacker / install-source-guardian-php70.sh
Last active October 16, 2019 19:34
Install source guardian on web70 VM
#!/bin/bash
# This quick and dirty script installs the Source Guardian loader on the web70 VM.
# Similar commands should work on other version of PHP -- simply replace the .lin file copied and the .ini file with the correct version.
cd /tmp
wget https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz -O ./source-guardian.tgz
mkdir source-guardian
@ericthehacker
ericthehacker / system.xml
Last active August 1, 2018 13:30
System.xml snippet to inform user of values set in env.php
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="catalog">
<group id="search">
<!-- add messaging for fields which are set in env.php -->
<field id="elasticsearch_server_hostname" translate="label comment" canRestore="1">
<comment>
This field is configured by the server environment. Any changes will not take effect.
</comment>
@ericthehacker
ericthehacker / gist:8a24c147d93c8024bac5
Created June 18, 2015 19:42
responsive gray area fix
@media (max-width: $bp-large) and (min-width: $bp-medium) {
html {
position: relative;
overflow: hidden;
&:before {
content: "Resize your browser";
background-color: black;
color: white;
display: block;
@ericthehacker
ericthehacker / gist:4e2101bce72930a1d308
Created May 2, 2015 18:53
magento 2 config scope hints composer.json snapshot
{
"name": "ericthehacker/magento2-configscopehints",
"description": "Magento 2 store config override hints module",
"require": {
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "2.0",
"extra": {
"map": [
@ericthehacker
ericthehacker / gist:94097907304a000da855
Created May 2, 2015 18:44
Magento 2 config scope hints helper snapshot
<?php
namespace EW\ConfigScopeHints\Helper;
use \Magento\Store\Model\Website;
use \Magento\Store\Model\Store;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/** @var \Magento\Framework\App\Helper\Context */
protected $_context;
@ericthehacker
ericthehacker / gist:e9394d1e4be0dde2bca6
Created May 2, 2015 18:41
Example of Magento 2 around plug-in di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<type name="Magento\Config\Block\System\Config\Form">
<plugin name="configScopeHints" type="EW\ConfigScopeHints\Model\Plugin" sortOrder="100" />
</type>
</config>
@ericthehacker
ericthehacker / gist:89371104df3255ec415d
Created May 2, 2015 18:40
Example of around M2 plug-in
<?php
namespace EW\ConfigScopeHints\Model;
use \Magento\Config\Model\Config\Structure\Element\Field;
use \Magento\Framework\Phrase;
class Plugin
{
/** @var \EW\ConfigScopeHints\Helper\Data */
protected $_helper;
@ericthehacker
ericthehacker / modman
Created May 2, 2015 17:16
config scope hints modman file
app/code/community/EW/ConfigScopeHints
app/etc/modules/EW_ConfigScopeHints.xml
app/design/adminhtml/default/default/layout/ew/configscopehints.xml
skin/adminhtml/default/default/ew/configscopehints
## translations
app/locale/en_US/EW_ConfigScopeHints.csv
app/locale/es_ES/EW_ConfigScopeHints.csv
@ericthehacker
ericthehacker / gist:0e72db3d44beee011b3d
Created May 2, 2015 17:09
EW_ConfigScopeHints_Helper_Data
<?php
class EW_ConfigScopeHints_Helper_Data extends Mage_Core_Helper_Abstract
{
const PROFILER_KEY = 'EW_ConfigScopeHints';
/**
* Get default store ID.
* Abstracted so it can be improved if default store
* ID not always 0.
@ericthehacker
ericthehacker / local.xml
Last active January 24, 2020 00:22
Local.xml nodes to disable annoying and/or inefficient admin spam
<?xml version="1.0"?>
<config>
<!-- disable annoying adminhtml observers and modules -->
<adminhtml>
<events>
<controller_action_predispatch>
<observers>
<awall_exts>
<type>disabled</type>
</awall_exts>