Skip to content

Instantly share code, notes, and snippets.

Standa standa

  • Standa
  • Prague, Czech Republic, Europe
Block or report user

Report or block standa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@standa
standa / terminal.php
Created Nov 27, 2019
Ingenico POS Payment Terminal Test Script
View terminal.php
<?php declare(strict_types=1);
namespace Maternia\Utils\Terminal;
error_reporting(E_ALL);
ini_set('display_errors', '1');
ob_implicit_flush();
const HOST = '192.168.0.176';
@standa
standa / mail.php
Last active Oct 6, 2018
OpenCart Mailgun And Database Mail Logging class
View mail.php
<?php
class Mail
{
// @author standa | additional features related to mailgun and logging
use MailgunTrait, LoggedEmailTrait;
public function send()
{
// ...
@standa
standa / DomainChecker.php
Created Oct 6, 2018
Multiple Domain Title Checker
View DomainChecker.php
<?php
DomainChecker::checkDomains();
/**
* @author standa <standa@jasa.name>
* @version 2014-11-25
*/
class DomainChecker
{
View parse_mailgun_webhook_stdin.php
<?php
function parse_mailgun_webhook_stdin(): array
{
$raw = file_get_contents('php://input');
$json = json_decode($raw, true);
$order_id = $json['event-data']['user-variables']['order_id'] ?? $json['event-data']['user-variables']['order-id'] ?? null;
$mail_id = $json['event-data']['user-variables']['mail_id'] ?? $json['event-data']['user-variables']['mail-id'] ?? null;
$recipient = $json['event-data']['recipient'] ?? null;
@standa
standa / DefaultController.php
Created Sep 25, 2018
Router with callables
View DefaultController.php
<?php
namespace League\Framework\Server\Controller;
use League\Plates\Engine;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* Example implementation of the default routing strategy (RequestResponseStrategy)
@standa
standa / order-callback.js
Created Apr 5, 2018
Apply a callback to orders you see in /admin/orders grid
View order-callback.js
var description = 'GoExpress delay of delivery for all the parcels from 3.04, because of Easter';
$('.data-admin input[name="orderIds[]"]').each((k,v) => {
var orderId = v.value
var data = new FormData()
data.append('order-report-type', 7) // DELAY
data.append('order-report-description', description)
var request = new XMLHttpRequest();
request.open("POST", "/admin/order-report/report/orderId/"+orderId);
request.send(data);
@standa
standa / gsx_db_web.php
Last active Feb 12, 2018
Update website via google spreadsheets
View gsx_db_web.php
<?php
/**
* @see https://www.reddit.com/r/PHP/comments/7wu9w5/gsx_db_update_your_website_data_instantly_with_a/
*/
class Gsx_db {
var $google_page_id;
var $tables;
@standa
standa / upgrade-php-to-72.sh
Created Jan 18, 2018
Upgrade PHP 7.1 -> 7.2
View upgrade-php-to-72.sh
#!/usr/bin/env bash
# TODO: EXPERIMENTAL run command by command as it will spit errors!
# ERRRORS: php-xdebug not working for php 7.2 yet!
if [ $EUID -ne 0 ]; then
exec sudo $0
fi
systemctl stop apache2
@standa
standa / logs-tee.php
Created Jan 4, 2018
Apache gzip logs by domain
View logs-tee.php
<?php
/**
* Process all apache *.log.gz access logs in current directory
* - split data by domain (first field in access log)
*/
if (!is_dir('out')) {
mkdir('out');
}
@standa
standa / ping.php
Last active Nov 29, 2017
Error ping
View ping.php
<?php
/**
* @example Run as `php ping.php`
*
* Ping and keep pinging every 5 seconds.
*
* Print out only the errored packets
*/
You can’t perform that action at this time.