Skip to content

Instantly share code, notes, and snippets.

@MattHealy
MattHealy / sign.php
Created June 30, 2021 11:54
PHP HMAC-SHA512 example
<?php
// HMAC-SHA512 signing
function get_signature($event, $orderid, $listing_id) {
// Hashing algorithm to use
$algo = 'sha512';
// Shared key used for signing payloads
@hostep
hostep / composer-v2-support-older-magento2-versions.md
Last active July 2, 2025 00:06
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!

@bsdnomad
bsdnomad / magento-1-nginx.md
Created October 7, 2019 13:26 — forked from hanhpv/magento-1-nginx.md
Magento 1 nginx configuration
server { 
	listen 80; 
	root /Users/admin/htdocs/vax-uk;
	index index.php index.html index.htm;
	 
	server_name vax.local; 
	access_log /usr/local/etc/nginx/logs/vax_access.log;
	access_log /usr/local/etc/nginx/logs/vax_error.log;
	 
@MrRio
MrRio / README.md
Last active March 5, 2025 21:38
Speed up your phpunit code coverage output in Laravel

Speed up your phpunit code coverage output in Laravel.

Your coverage reports are slowed down by xdebug tracing within Laravel and packages you depend on, despite them not being in your final coverage report. This moves the filtering from phpunit into xdebug itself.

Before: Time: 5.33 minutes, Memory: 10.00 MB

After: Time: 1.5 minutes, Memory: 10.00 MB

./vendor/bin/phpunit --coverage-html=results/coverage

@artoodetoo
artoodetoo / example.php
Created January 20, 2019 10:27
Laravel: run standalone console script without touching the project code
<?php
/*
* The code mostly peeped in artisan executable file.
* Put this file to project root (one level above DocumentRoot) and run
* $ php example.php
*/
if (php_sapi_name() !== 'cli') {
die('This file can be executed from console only');
}
@ProcessEight
ProcessEight / Testing in Magento 2.md
Last active July 9, 2025 14:33
M2: Notes on setting up PHPUnit and writing/troubleshooting tests in Magento 2
@bh-ref
bh-ref / RemoveOptions.php
Last active December 28, 2021 21:06
Remove/Delete Product Attribute Options in Magento 2
<?php
namespace Vendor\ModuleName\Options;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
class RemoveOptions
{
@justinledwards
justinledwards / camerasettings.sh
Created September 17, 2015 23:12
Camera settings on v4l2
#!/bin/bash
v4l2-ctl -c brightness=0
v4l2-ctl -c contrast=120
v4l2-ctl -c white_balance_temperature_auto=0
v4l2-ctl -c gamma=120
v4l2-ctl -c white_balance_temperature=4700
v4l2-ctl -c sharpness=100
v4l2-ctl -c backlight_compensation=0
v4l2-ctl -c focus_absolute=10
v4l2-ctl --list-ctrls-menus
@carbontwelve
carbontwelve / usefull_commands.sh
Last active June 24, 2021 06:10
Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
# Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
php -dxdebug.remote_autostart artisan
#Running phpcs for 5.3:
phpcs -pv --standards= --runtime-set testVersion 5.3 --ignore=*/public/*,*.js,*.css,*/tests/*,*/views/training/* .
@AdamMagaluk
AdamMagaluk / test.js
Last active November 17, 2022 14:04
Node.js aes 128 ecb encryption issue
var key = new Buffer('E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FA','hex');
var text = '6743C3D1519AB4F2CD9A78AB09A511BD';
var decipher = crypto.createDecipheriv('AES-128-ECB',key,'');
//decipher.setAutoPadding(false); this makes it work?
var k1 = decipher.update(text,'hex','hex'); // Why is this ''???
var k2 = decipher.update(text,'hex','hex');
console.log("de k1:" + k1) // is equal to '' but should be 014baf2278a69d331d5180103643e99a
console.log("de k2:" + k2) // is equal to 014baf2278a69d331d5180103643e99a