Skip to content

Instantly share code, notes, and snippets.

View ProxiBlue's full-sized avatar
🏠
Working from home

Lucas van Staden ProxiBlue

🏠
Working from home
View GitHub Profile
<?php
declare(strict_types=1);
namespace Enjo\Pure\Ui\DataProvider\Product\Form\Modifier;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form\Field;
use Magento\Ui\Component\Form\Fieldset;
use Magento\Ui\Component\Form\Element\Textarea;
@ProxiBlue
ProxiBlue / declinedTransactions.php
Created November 6, 2018 03:34
Count Declined Payments From exception.log per day
<?php
/**
* Just a rough script to parse the exception log, find all entries that match the Declined string, and group
* them by day.
* This effectively shows a major increase in a sites number of declind transactions, for which scripting was the cause
* Setup of reCapctha at checkout stopped this issue
*
* Log example:
* 2017-06-22T15:17:06+00:00 ERR (3):
* exception 'Mage_Core_Exception' with message 'Declined: 15005-This transaction cannot be processed.' in public_html/app/Mage.php:603
$('form input:text').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId.replace(':', '\\:')+']')).length === 1) {
$(elem).attr('placeholder', $(label).html().replace(/<\/?[^>]+(>|$)/g, ""));
@ProxiBlue
ProxiBlue / gist:e797f00735fbf0a06ddb55e837b9140a
Last active February 8, 2018 01:55
Record sensibo pod temperature. added in calculation for Feel like as used by sensibo Climate React and different Apparent calculation to allow comparisons
<?php
$fp = fopen('/tmp/temp_monitor.csv', 'a');
$curl = curl_init('https://home.sensibo.com/api/v2/pods/jFFZuNq6/measurements?apiKey=MxeORFfanBUJnCbd3HLmssEYJF2WbO');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occurred during curl exec. Additional info: ' . var_export($info));
}
@ProxiBlue
ProxiBlue / gist:f7a751c9634a175bde1d6725abd7ce6c
Created February 5, 2018 02:19
Sensibo AC Climate React Scheduling via API
#!/bin/bash
STATE=$1
echo $STATE
curl -X PUT -H "Content-Type: application/json" -d '{"enabled":'${STATE}'}' https://home.sensibo.com/api/v2/pods/DEVICE_ID/smartmode/?apiKey=API KEY
@ProxiBlue
ProxiBlue / gist:fdf28f9bf8b678e9aa30c475d681f974
Created January 27, 2018 09:11
ReCaptcha Email a friend template changes diff
diff --git a/app/design/frontend/default/theme567/template/sendfriend/send.phtml b/app/design/frontend/default/theme567/template/sendfriend/send.phtml
index 14432118..be6096dc 100644
--- a/app/design/frontend/default/theme567/template/sendfriend/send.phtml
+++ b/app/design/frontend/default/theme567/template/sendfriend/send.phtml
@@ -32,8 +32,13 @@
?>
<script type="text/javascript">
//<![CDATA[
- i=0;
- var recipCount = 1;
@ProxiBlue
ProxiBlue / gist:bff88b184c9c0e44997ff6ae05468b01
Created January 27, 2018 09:10
ReCaptcha Email to a friend template with changes
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@ProxiBlue
ProxiBlue / gist:dfc74f35721b57e96b560d898cb6bfeb
Last active May 5, 2017 13:41
a script i run on any db to make it local dev ready
#!/bin/bash
n98-magerun --scope-id=0 config:set web/unsecure/base_url {{base_url}}
n98-magerun --scope-id=0 config:set web/secure/base_url {{base_url}}
n98-magerun --scope-id=1 --scope="stores" config:set web/unsecure/base_url {{base_url}}
n98-magerun --scope-id=1 --scope="stores" config:set web/secure/base_url {{base_url}}
n98-magerun --scope-id=1 --scope="stores" config:set web/unsecure/base_skin_url {{base_url}}/skin
n98-magerun --scope-id=1 --scope="stores" config:set web/secure/base_skin_url {{base_url}}/skin
n98-magerun --scope-id=0 config:set web/unsecure/base_skin_url {{base_url}}/skin
n98-magerun --scope-id=0 config:set web/secure/base_skin_url {{base_url}}/skin
@ProxiBlue
ProxiBlue / varstosession
Created July 5, 2016 14:48
inject vars to session
protected $_paramsToTrack = array("offer_followup");
/**
* Capture any listened for parameters, and inject them into the session
* under a variable called : ProductOfferUrlParams
*
* You must clear this variable with a call to
*
* Mage::getSingleton('customer/session')->unsProductOfferUrlParams();
*
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Run with: vagrant up --provider=docker
# to get a dns entry for the docker machines use DNSGUARD
# docker run -d -v /var/run/docker.sock:/var/run/docker.sock --restart always --name dnsdockmain -p 172.17.42.1:53:53/udp tonistiigi/dnsdock -domain=".local.com" -nameserver="192.168.50.20:53"
#
# common usage: vagrant --name=magento up --provider=docker
require 'getoptlong'