Skip to content

Instantly share code, notes, and snippets.

View chickenland's full-sized avatar

Douglas Radburn chickenland

View GitHub Profile
@chickenland
chickenland / jira-security-ppusers.user.js
Last active June 30, 2022 14:34
Set JIRA security setting to PP Users
// ==UserScript==
// @name AutoSet to PP Users in JIRA tickets
// @namespace Pinpoint Designs
// @version 0.1
// @description When a user hits "Add a comment ..." in JIRA, then it will auto assign security to "PP Users"
// @author Douglas Radburn @ Pinpoint Designs
// @match https://pinpointdesigns.atlassian.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @require https://code.jquery.com/jquery-1.8.3.min.js
// @grant none
@chickenland
chickenland / gist:0adb68561045cb293106294e542d7a8d
Created May 21, 2021 20:01
Magento24 command-line install
php73 -dmemory_limit=-1 /usr/local/bin/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
mysql -uroot -proot -e "create database TESTINGDB"
php73 -dmemory_limit=-1 bin/magento setup:install --base-url="http://TESTING.local/" \
--db-host="localhost" --db-name="TESTINGDB" --db-user="root" --db-password="root" \
--admin-firstname="admin" --admin-lastname="admin" --admin-email="admin@admin.com" --admin-user="admin" --admin-password="admin123" \
--language="en_US" --currency="GBP" --timezone="Europe/London" --use-rewrites="1" --backend-frontname="admin"
@chickenland
chickenland / find-differences.php
Created September 7, 2020 13:16
Tried to make something quick and dirty that would try to find out if a vendor theme was overriding a Magento template and if there were any differences
<?php
$pathLen = 0;
$foundCompare = $notExistingForCompare = $nonMagentoForCompare = [];
$files = ['phtml', 'xml'];
function compareFiles($a, $b)
{
// Check if content is different
$ah = fopen($a, 'rb');
# Manually secure port 6379
sudo iptables -A INPUT -p tcp --dport 6379 -s xxx.xxx.xxx.xxx -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 6379 -j DROP
sudo iptables -L
# Save current firewall config
sudo iptables-save > /etc/iptables.conf
# Load iptables.conf on startup
sudo nano /etc/rc.local
@chickenland
chickenland / app-code-Pinpoint-Handle-Observer-AddLayoutHandle.php
Last active February 14, 2018 14:45
Magento Add Layout Handle & XML Update
<?php
namespace Pinpoint\Handle\Observer;
class AddLayoutHandle implements \Magento\Framework\Event\ObserverInterface
{
/**
* @var \Magento\Framework\Registry
*/
protected $_registry;
@chickenland
chickenland / M2-Logger
Last active January 12, 2024 13:31
Magento2 Logger to use anywhere
Magento 2.4.2 or earlier:
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/my.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
Magento 2.4.3+:
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/my.log');
<?php
use \Magento\Eav\Setup\EavSetup;
use \Magento\Framework\Setup\UpgradeDataInterface;
use \Magento\Framework\Setup\ModuleContextInterface;
use \Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\TestFramework\Helper\Eav;
/** UpgradeDataInterface */
class UpgradeData implements UpgradeDataInterface
@chickenland
chickenland / magento2-product-attributes
Created April 18, 2017 10:06
Magento2 Add options to existing product attribute
<?php
use \Magento\Eav\Model\Entity\Attribute\OptionManagementFactory;
use \Magento\Eav\Model\Entity\Attribute\OptionFactory;
use \Magento\Framework\Setup\UpgradeDataInterface;
use \Magento\Framework\Setup\ModuleContextInterface;
use \Magento\Framework\Setup\ModuleDataSetupInterface;
use \Magento\Framework\App\State;
class UpgradeData implements UpgradeDataInterface
server {
listen 80;
server_name $1; ## Domain is here twice so server_name_in_redirect will favour the www
root /var/www/$2;
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}
@chickenland
chickenland / gist:b7ad02ce862b4736d5cd136a249a8ee3
Created February 22, 2017 13:59
Find version numbers from all app/code/local & app/code/community modules in M1
<?php
$folders = array("community", "local");
$path = "app/code/";
$filenotexists = array();
foreach ($folders as $folder) {
echo $folder . "\n";
$namespaces = scandir($path . $folder);