Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Egginton maderlock

View GitHub Profile
@maderlock
maderlock / map_size.js
Created Nov 16, 2020
Roll20 API script to contract and expand maps
View map_size.js
myGetCleanImagesrc = function (imgsrc) {
var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)([^?]*)(\?[^?]+)?$/);
if(parts) {
return parts[1]+'thumb'+parts[3]+(parts[4]?parts[4]:`?${Math.round(Math.random()*9999999)}`);
}
return;
};
// When a map changes vertical location, resize
const x_threshold = 800;
on("change:graphic:top", function(obj, prev) {
@maderlock
maderlock / amcaptcha.phtml
Created Sep 8, 2017
Allowing multiple forms to be recaptcha'ed with Amasty Invisible Google ReCaptcha for Magento 2
View amcaptcha.phtml
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) 2017 Amasty (https://www.amasty.com)
* @package Amasty_InvisibleCaptcha
*/
?>
<?php
/**
*
@maderlock
maderlock / Observer_AfterOrderInvoiceAddresses.php
Created Sep 6, 2016
Temporary fix for Magento 2 bug where invoices for PayPal orders do not have address information attached. This mainly shows up in the grid. See https://github.com/magento/magento2/issues/6438
View Observer_AfterOrderInvoiceAddresses.php
<?php
namespace C3\Magento2Fixes\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Sales\Model\Order\InvoiceFactory;
class AfterOrderInvoiceAddresses implements ObserverInterface
{
@maderlock
maderlock / C3\Utility\DuplicateDatabase.php
Created Sep 2, 2016
PHP class to duplicate database
View C3\Utility\DuplicateDatabase.php
<?php
namespace C3\Utility;
use Monolog\Logger;
/**
* Class DuplicateDatabase
*
* @package C3\Utility