Skip to content

Instantly share code, notes, and snippets.

version: 1
backend:
phases:
build:
commands:
- |-
export X=`npm root -g`
cd $X/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation && npm install ajv@^6.12.3
- amplifyPush --simple
frontend:
@hostep
hostep / composer-v2-support-older-magento2-versions.md
Last active January 27, 2024 10:37
Add composer v2 support to older Magento2 versions

Add composer v2 support to older Magento2 versions

Magento 2.3.7 and 2.4.2 ship with composer v2 support out of the box but as far as I can see the only thing that needs to happen is to use some more modern versions of certain composer plugins which are used by certain dependencies of Magento.

This means we should be able to add composer v2 support to older Magento2 versions as well if we get a bit creative.

See below for diffs of the composer.json files you can apply to your projects, be sure to keep a mental note of these things, they will need to maintained by yourself in case newer versions of these modules are released. And if one day you update to Magento 2.3.7 or 2.4.2 or higher, you can remove these changes again.

⚠️ Disclaimer: use these tricks at your own risk!

@codeAdrian
codeAdrian / React Protected Route
Last active August 23, 2019 07:54
React Protected Route Component - based on https://tylermcginnis.com/react-router-protected-routes-authentication/ and extended with redirect prop
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
const PrivateRoute = ({
component: Component,
isAuthenticated,
redirectTo,
...rest
}) => (
<Route
@stu-smith
stu-smith / lambda-at-edge.yaml
Last active August 5, 2021 17:09
Shows how to use CloudFormation to attach a Lambda@Edge function to a CloudFront distribution to add HSTS and CSP custom headers. NOTE: The stack must be updated twice: once with the condition set to false, and once with it set to true.
AWSTemplateFormatVersion: 2010-09-09
Parameters:
RootDomainName:
Type: String
IncludeLambdaEdge:
Type: String
AllowedValues: ['true', 'false']
Conditions:
IncludeLambdaEdge:
!Equals ['true', !Ref IncludeLambdaEdge]
@cmtickle
cmtickle / unbuffered_shell_example.php
Created January 31, 2018 14:55
Use unbuffered SQL queries with Magento to reduce memory usage on large data sets.
<?php
require_once 'abstract.php';
class Cmtickle_Demo_Shell_Tool extends Mage_Shell_Abstract
{
private $_readConnection = null;
protected function _getReadConnection()
{
@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
@jed
jed / deploy.sh
Last active April 24, 2024 15:45
Using AWS CloudFormation to deploy an edge lambda
#!/bin/sh
aws cloudformation deploy \
--template-file stack.yaml \
--stack-name edge-lambda-test \
--capabilities CAPABILITY_IAM \
--parameter-overrides Nonce=$RANDOM
Namespace/Module/view/adminhtml/requirejs-config.js
--
var config = {
config: {
mixins: {
'mage/validation': {
'Namespace_Module/js/form/validation/validate-greater-than-field-value': true
}
}
}
@brobie
brobie / gist:5cfb055ec190f40bb8c059c31ab430f6
Created May 25, 2017 01:58
Joining Data For Order Grid
<virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
<arguments>
<argument name="joins" xsi:type="array">
<item name="table_that_you_want_to_join" xsi:type="array">
<item name="table" xsi:type="string">table_that_you_want_to_join</item>
<item name="origin_column" xsi:type="string">entity_id</item>
<item name="target_column" xsi:type="string">parent_id</item>
</item>
</argument>
<argument name="columns" xsi:type="array">
@aboritskiy
aboritskiy / SyncURLsCommand.php
Last active July 1, 2021 15:15
Magento2 EE Cloud tips and tricks
<?php
namespace Sitewards\SyncURLs\Console\Command;
use \Symfony\Component\Console\Command\Command;
use \Symfony\Component\Console\Input\InputInterface;
use \Symfony\Component\Console\Output\OutputInterface;
use \Magento\Framework\App\Config\ConfigResource\ConfigInterface;
use \Magento\Store\Model\StoreManagerInterface;