Skip to content

Instantly share code, notes, and snippets.

View Zifius's full-sized avatar

Alexander Turiak Zifius

View GitHub Profile
@Zifius
Zifius / Solution.md
Created February 6, 2021 10:21
REST Metric Module

Problem Statement: Logging of REST requests, groupping (e.g. customer routes with ids), status codes, response times

Units:

  1. Logger
  2. Aggregator

Technologies:

  1. Redis (for with multi-web-node setup)
  2. Files?
  3. Kibana?
@Zifius
Zifius / coding-standards.yml
Last active August 9, 2023 09:25
Magento phpcs using GitHub Actions
name: Coding Standards
on:
pull_request:
paths:
- "**.php"
- "**.phtml"
jobs:
phpcs:
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@Zifius
Zifius / cleanup.php
Last active June 23, 2016 09:45
Shell script to remove unassigned simple products
<?php
/**
* This script is used to clean up unassigned simple products
*
* @author Alexander Turiak <alex@hexbrain.com>
* @copyright Copyright (c) 2014 HexBrain (http://www.hexbrain.com)
*/
require_once 'abstract.php';
@Zifius
Zifius / get-gallery-images.sql
Last active March 24, 2016 00:16 — forked from tegansnyder/get-images-for-sku.sql
Query to get all gallery images with position and disabled flag
@Zifius
Zifius / gist:10970496
Created April 17, 2014 10:03
PO Box check for Magento checkout
Validation.add('no-po-box', 'The shipping address must be a physical address. PO Boxes are allowed for billing only.', function(v) {
return /^box.*|^po.*box.*|^p\.o\..*box.*/i.test(v) === false;
});
curl -o index.php.orig https://raw.github.com/speedupmate/Magento-CE-Mirror/magento-ce-1.7.0.2/index.php && diff index.php.orig index.php && rm -f index.php.orig
Example output:
Alexs-MacBook-Pro:MageHackDay Alex$ curl -o index.php.orig https://raw.github.com/speedupmate/Magento-CE-Mirror/magento-ce-1.7.0.2/index.php && diff index.php.orig index.php && rm -f index.php.orig
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2642 100 2642 0 0 3755 0 --:--:-- --:--:-- --:--:-- 3758
34c34
< exit;
@Zifius
Zifius / gist:5438660
Created April 22, 2013 21:22
Adding an item to existing order
<?php
class WhatEver
{
/**
* Adds a product to existing order
*
* @param string $orderIncrementId Order increment id
* @param string $itemSku Product SKU
@Zifius
Zifius / gist:3318209
Created August 10, 2012 21:30
Magento visibility being reset
<?php
// If you have hidden products never do collection
// saving, without adding visibility attribute to select
$products = Mage::getModel('catalog/product')
->getCollection()
// Important or visibility will be reset to default value (Visible in Catalog and Search)
->addAttributeToSelect(array('visibility', 'name'));
foreach ($products as $product) {
@Zifius
Zifius / gist:1073576
Created July 9, 2011 13:13
Ajax controller with JSON response for Kohana 3.1
<?php
class Controller_Ajax extends Controller {
public function before()
{
if (!$this->request->is_ajax())
{
$this->request->redirect();
}