Skip to content

Instantly share code, notes, and snippets.

View aleron75's full-sized avatar

Alessandro Ronchi aleron75

View GitHub Profile
@markshust
markshust / gist:aa5d7e4918144e82f7d7d2b93c367091
Last active April 13, 2019 04:53
composer install magento 2.3
# from tagged packagist version
composer create-project magento/community-edition:dev-2.3-develop
# from tagged magento repo
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.3.0-beta8
@TravisBernard
TravisBernard / allthethings.sh
Last active August 18, 2018 21:12
Clean all the things (M2)
#!/bin/bash
# Derived from
# https://github.com/btford/allthethings
#
# Licensed under WTFPL http://sam.zoy.org/wtfpl/
#
pur=$(tput setaf 5) # Purple
@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
@amenk
amenk / README.md
Created January 29, 2018 15:07
How To Apply a Magento 2 Patch to your project
  • Find the commit a GitHub
  • Add .patch to the URL
  • Require vaimo/composer-patches
  • Add an entry like the above, with path-removal-level 5, to the composer.json
@IvanChepurnyi
IvanChepurnyi / optimize-composer.sh
Created September 30, 2016 16:00
Optimizes autoloader for the best performance on production system
#!/bin/bash
magentodir=$1
cd $magentodir
read -d '' script << PHP
<?php
\$composer = json_decode(file_get_contents('composer.json'), true);
if (!is_array(\$composer['autoload']['psr-0'][''])) {
<?php
trait Memoize
{
/**
* @var array [method][parameters]
*/
private $memoizedResults = [];
protected function memoizedCall($methodName, $args)
{
@wsakaren
wsakaren / install_magento2_with_db
Last active December 15, 2017 17:22
Install script for magento2 with database, assumes you are running from www.localhost.com/20
#!/bin/bash
# Sets up a database with a magento2 installation. This assumes you are running from under your httpdocs/<release> location and have www.localhost.com in your /etc/hosts file
# To run type : install_magento2 <dirname> <password> <release>
# password is used for the datbase user and the magento admin password
if [ $# -eq 0 ]; then
echo "No arguments supplied"
echo "Usage: `basename $0` <dirname> <password> <release>"
echo "e.g install_magento2.sh mage2 password 21"
exit 1
@Vinai
Vinai / M2 acl.xml
Last active October 17, 2023 05:38
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
@fbrnc
fbrnc / setup.sh
Last active March 5, 2017 01:53
X2GO PHPStorm Demo
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install software-properties-common
# X2Go
add-apt-repository -y ppa:x2go/stable && apt-get update
apt-get -y install x2goserver
# Download PHPStorm
@mam08ixo
mam08ixo / data-upgrade-0.1.67-0.1.68.php
Last active October 30, 2015 22:02 — forked from avoelkl/upgrade-0.1.67-0.1.68.php
SUPEE-6788 variable + block setup script. 1.) Create a new module or extend a current one. 2.) Create a new install or setup script with the variables and blocks which are not whitelisted yet.
<?php
/**
* @category Namespace
* @package Namespace_Module
* @author Anna Völkl
* @author Christoph Aßmann
* @author Fabian Schmengler
*/
/** @var Mage_Core_Model_Resource_Setup $installer */