Skip to content

Instantly share code, notes, and snippets.

/* Test IBAN values:
HR 15 2340 0093 2109 5545 7
HR 5023400093102278840
*/
#include <iostream>
#include <string>
#include <algorithm> // needed for remove_if
using namespace std;
<?php
/**
* Using PHP syntax, partition the array A into two arrays B and C in a way that that the difference between the
* sum of elements in B and the sum of elements in C is minimized.
*
* @author Stjepan Udovičić (stjepan.udovicic@inchoo.net)
*/
/** Predefined array */
$A = array(
@udovicic
udovicic / nginx.conf
Created January 15, 2015 08:57
nginx configuration for Sendy
upstream sendybackend {
server unix:/var/run/php-fcgi-sendy.sock;
}
server{
listen {server_ip}:80;
server_name sendy.{domain};
autoindex off;
@udovicic
udovicic / update.php
Created January 21, 2015 10:06
Script for triggering module updates and cache refresh for Magento EE
<?php
/**
* Upgrade script based on https://gist.github.com/colinmollenhour/2715268
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml
*
* Execute script to trigger upgrades and cache refresh
*/
require_once 'abstract.php';
@udovicic
udovicic / table_cleaning.sql
Created September 27, 2015 10:50
Magento extra table flush
SET foreign_key_checks = 0;
TRUNCATE `core_cache_option`;
TRUNCATE `core_cache_tag`;
TRUNCATE `core_session`;
TRUNCATE `dataflow_batch_export`;
TRUNCATE `dataflow_batch_import`;
TRUNCATE `enterprise_logging_event`;
TRUNCATE `enterprise_logging_event_changes`;
TRUNCATE `enterprise_support_backup`;
TRUNCATE `enterprise_support_backup_item`;
@udovicic
udovicic / temperature.py
Last active September 5, 2016 18:48
DHT22 sensors readings using Adafruit Python DHT Sensor Library
#!/usr/bin/python
# Requires Adafruit Python DHT Sensor Library
# https://github.com/adafruit/Adafruit_Python_DHT
# git@github.com:adafruit/Adafruit_Python_DHT.git
# Measures temperature 5 times, and sends average to thingspeak.
# First measurement is discarded.
# It is intended to be executed by cron in background

Preparing local environment for Magento development

This guide is based on Linux mint, Ubuntu based linux distribution. You can download it from here. It will help you setup apache environment in your home folder.

Packgae installation

You will need to install several things. First of them is Apache itself. From terminal run:

sudo apt-get install apache2
@udovicic
udovicic / sendmail.php
Created January 12, 2015 12:10
Fake sendmail - write content to file
#!/usr/bin/php
<?php
/**
* Fake mail sending: log content to file
*
* Instructions:
* 1. Save as /usr/sbin/sendmail
* 2. Make it executable
*/
#!/bin/bash
function get_project_handle ()
{
local project_handle=${PWD##*/};
echo ${project_handle}
}
if ! grep -q "www.$(get_project_handle).loc" /etc/hosts; then
@udovicic
udovicic / INSTRUCTIONS.md
Last active January 6, 2021 19:16
Instructions for setting up Magento 2 code analysis with PHPSTorm

Setting up MEQP Coding standard checks in PHPStorm

Overview

In order to submit extensions to Magento marketplace, source code needs to pass Magento Extension Quality Program Coding Standard checks.

You can either do it manually, by following this guide in official Github repository, or by fixing things as you code, by setting up check in PHP Storm.

Install and configure Code Sniffer on system