Skip to content

Instantly share code, notes, and snippets.

View vdubyna's full-sized avatar

Volodymyr Dubyna vdubyna

View GitHub Profile
jQuery.ajax({
contentType: 'application/json',
data: JSON.stringify({"username": "vdubina@lyonscg.com", "password": "Qwer1234"}),
dataType: 'json',
processData: false,
type: 'POST',
url: 'https://pha-m2-stg.lcgosc.com/rest/default/V1/integration/customer/token'
}).done(function (token) {
jQuery.ajax({
contentType: 'application/json',
@vdubyna
vdubyna / run-script.php
Created July 11, 2018 16:04
Run Magento 2 code in console
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application;
if (PHP_SAPI !== 'cli') {
echo 'dev/run-script.php must be run as a CLI application';

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@vdubyna
vdubyna / multiple_ssh_setting.md
Created February 5, 2018 16:38 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@vdubyna
vdubyna / sphp.sh
Created January 3, 2018 14:28 — forked from w00fz/sphp.sh
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage
@vdubyna
vdubyna / MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Created January 2, 2018 17:14 — forked from andrewstobbe/MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL

Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL 👍

Things I had to do using Homebrew to get my local web dev environment back up and running after migration to OSX Sierra + Xcode 8.1.

Note: I used brew reinstall because I had already installed most of this previously under Yosemite. Probably better ways to do this, but this is what worked for me.

brew doctor

brew tap homebrew/dupes
brew tap homebrew/versions
@vdubyna
vdubyna / openssl_commands.md
Created December 18, 2017 12:58 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@vdubyna
vdubyna / multiply-in-column.php
Created February 28, 2017 10:27
Multiply 2 numbers
function multiplyInColumn($a, $b) {
$bArr = array_reverse(str_split($b));
$aArr = array_reverse(str_split($a));
$result = array_map(function ($step, $bItem) use ($aArr) {
$rest = 0;
$result = array_fill(0, $step, 0);
$k = [
'a/b/c/j',
'a/b/c',
'a/b/d/q',
'a/b/d',
'a/b/e',
'a/b/c/j',
'a/b/c',
'a/b/d/q',
'a/b/d',
@vdubyna
vdubyna / Refresh.php
Created November 1, 2016 13:46
Fixed catalog_category_product indexer EE 1.14
/**
* Retrieve select for reindex products of non anchor categories
*
* @param Mage_Core_Model_Store $store
* @return Varien_Db_Select
*/
protected function _getAnchorCategoriesSelect(Mage_Core_Model_Store $store)
{
if (!isset($this->_anchorCategoriesSelect[$store->getId()])) {
/** @var $eavConfig Mage_Eav_Model_Config */