Skip to content

Instantly share code, notes, and snippets.

View brankoajzele's full-sized avatar

Branko Ajzele brankoajzele

View GitHub Profile
@brankoajzele
brankoajzele / gist:eb22ef28443dbadf30d0
Created July 30, 2014 20:27
elasticsearch-requests-generator
<?php
if(php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) {
exit('Only shell execution execution is allowed!');
}
$csv = $argv[1]; /* Full absolute path to CSV file */
$_index = $argv[2]; /* Index */
$_type = $argv[3]; /* Index type */
$_id = $argv[4]; /* CSV column to use for ID */
@brankoajzele
brankoajzele / gist:38fa394d0b276aa5dab8
Created July 30, 2014 20:26
magento-csv-product-generator
<?php
/* Magento CSV products generator */
if(php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) {
exit('Only shell execution execution is allowed!');
}
require_once 'faker/autoload.php';
@brankoajzele
brankoajzele / gist:9487779
Created March 11, 2014 15:08
Simple SOAP 'magento.info' API call on clean Magento 1.8
2014-03-11T15:06:50+00:00 DEBUG (7): Array
(
[REDIRECT_HTTP_AUTHORIZATION] =>
[REDIRECT_TMP] => C:/Program Files (x86)/Ampps/tmp
[REDIRECT_STATUS] => 200
[HTTP_AUTHORIZATION] =>
[TMP] => C:/Program Files (x86)/Ampps/tmp
[HTTP_HOST] => magento18.ce
[HTTP_CONNECTION] => close
[PATH] => C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Fingerprint Manager Pro\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Ampps\php;C:\Program Files (x86)\Ampps\mysql\bin;C:\Program Files (x86)\Ampps\a
@brankoajzele
brankoajzele / gist:8425397
Created January 14, 2014 20:48
CentOS 6.5 + Phalcon 1.2.5 + PHP 5.3.3
[root@box1 build]# sudo ./install safe
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
@brankoajzele
brankoajzele / .gitignore
Created November 2, 2013 15:25
.gitignore for Magento
# General web stuff
/.htaccess
/robots.txt
/sitemap.xml
# Dynamic Magento data that doesn't need to be in the repo
/var/*
/media/*
/downloader/pearlib/cache/*
/downloader/pearlib/download/*
/app/etc/use_cache.ser
@brankoajzele
brankoajzele / gist:6120080
Created July 31, 2013 07:40
The "Go back" button for Magento. Designed so that if you landed on Magento from external site then button wont be shown.
<?php if (($referrer = Mage::app()->getRequest()->getServer('HTTP_REFERER'))): ?>
<?php $storeUrlParts = parse_url(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)); ?>
<?php $referrerUrlParts = parse_url($referrer); ?>
<?php if ($storeUrlParts['host'] === $referrerUrlParts['host']): ?>
<button type="button" title="<?php echo $this->__('Go back to %s', $referrer) ?>" class="button" onclick="this.innerHTML = '<?php echo $this->__('Redirecting...') ?>'; window.location = '<?php echo $referrer ?>';"><?php echo $this->__('Back') ?></button>
<?php endif; ?>
<?php endif; ?>
@brankoajzele
brankoajzele / gist:5412688
Last active December 16, 2015 09:28
Loto number generator
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
/* Loto _x out of _y */
int _x = 7, _y = 39;
NSMutableArray *numbers = [[NSMutableArray alloc] init];
@brankoajzele
brankoajzele / gist:5114877
Created March 8, 2013 07:55
gitignore for Magento
.htaccess
# Dynamic data that doesn't need to be in the repo
/var/*
/media/*
/downloader/pearlib/cache/*
/downloader/pearlib/download/*
/app/etc/use_cache.ser
/app/etc/local.xml
/errors/local.xml
<?php
$XMLRequestDOMDoc = new DOMDocument();
$XMLRequestDOMDoc->loadXML($XMLRequest);
$canonical = $XMLRequestDOMDoc->C14N();
$DigestValue = base64_encode(hash('sha1', $canonical, true));
$rootElem = $XMLRequestDOMDoc->documentElement;
<?php
$UriId = uniqid();
$ns = 'tns';
$writer = new XMLWriter();
$writer->openMemory();
//$writer->startDocument('1.0', 'UTF-8');