Skip to content

Instantly share code, notes, and snippets.

View antonshell's full-sized avatar

Anton Shelyganov antonshell

View GitHub Profile
<?php
public function createContact(){
$data = [
"emails"=>[
"tag"=>"work",
"email"=>"karen_meep@wix.com",
"emailStatus"=>"recurring"
]
<?php
/**
* Created by PhpStorm.
* User: Antonshell
* Date: 31.08.2015
* Time: 14:40
*/
/**
* Class WixService
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
/* link no decor*/
.no-decor, .no-decor, .no-decor:visited, .no-decor:hover, .no-decor:focus, .no-decor:active{
color: inherit;
text-decoration: none;
}
/*--------------------------*/
@antonshell
antonshell / gist:2116fc751288023a88474524185495c3
Created October 3, 2017 07:42
Set notepad++ as commit info editor
git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
@antonshell
antonshell / gist:3ca2772fbe4c46abfbbfe58fa5bb71d8
Last active October 3, 2017 15:30
egrul-nalog-parser examples
<?php
$parser = new \antonshell\EgrulNalogParser\Parser();
// parse for Individual Entrepreneur
$pathPe = __DIR__ . '/nalog_pe.pdf';
$results = $parser->parseNalogPe($pathPe);
// parse for Organization
$pathOrg = __DIR__ . '/nalog_org.pdf';
@antonshell
antonshell / gist:a720c37007ac6ef459cf1155c0429d19
Created December 29, 2017 08:34
Magento Database Config Helper
<?php
namespace Antonshell\OrdersWebhooks\Services;
use Antonshell\OrdersWebhooks\Observer\MOrderSaveObserver;
use Magento\Framework\Event\ConfigInterface;
use Magento\Framework\Event\InvokerInterface;
use ReflectionClass;
use Symfony\Component\Console\Output\ConsoleOutput;
@antonshell
antonshell / gist:9d07e666b8f3e427c84c024e4417da2e
Created March 1, 2018 09:52
Hide system section from phpinfo()
<?php
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
$startPos = strpos($phpinfo,'<tr><td class="e">System </td>');
$endPos = strpos($phpinfo,'</tr>',$startPos);
$output = substr($phpinfo, 0,$startPos);
@antonshell
antonshell / parse.php
Created July 5, 2018 15:30
Yandex money sms parser
<?php
// generator is here:
// https://funpay.ru/yandex/emulator
function parseMessage($message){
//code
preg_match("/[' '][0-9]{4}['\n']/", $message, $code);
$code = $code[0] ?? '';
$code = trim($code);
@antonshell
antonshell / databases_backup_aws.sh
Last active February 9, 2021 06:42
Backup MySQL databases to Amason S3. Related tutorial: https://antonshell.me/post/aws-s3-mysql-backup
#! /bin/bash
TIMESTAMP=$(date +"%F-%T")
BACKUP_DIR="/var/backups/databases/$TIMESTAMP"
MYSQL_USER="backup"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQL_HOST="localhost"
AWS=/usr/bin/aws