Skip to content

Instantly share code, notes, and snippets.

View osrecio's full-sized avatar

Oscar Recio osrecio

View GitHub Profile
@osrecio
osrecio / Magento_phpcs_Phpstorm.md
Created June 14, 2017 11:43
Add PHPCS PHPStorm for Magento

Install PHPCS and add Magento Standars

composer global require magento-ecg/coding-standard
composer global require magento/marketplace-eqp
export PATH=$HOME/bin:/usr/local/bin:$PATH:$HOME/.composer/vendor/bin
phpcs --config-set installed_paths $HOME/.composer/vendor/magento-ecg/coding-standard/,$HOME/.composer/vendor/magento/marketplace-eqp/

Configure PHPCS into PHP Storm

#!/bin/sh
#================================================================================
# virtualhost.sh 1.35
#
# A fancy little script to manage virtualhosts on Mac OS X.
#
# For usage help and available commands run `virtualhost.sh`.
#================================================================================
# Don't change this!
version="1.35"
xdebug.remote_enable=1
xdebug.max_nesting_level = 500
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0
xdebug.remote_autostart = on
xdebug.remote_host = "127.0.0.1"
@osrecio
osrecio / magento_urls.php
Created August 18, 2016 15:17
Get all magento Urls
<?php
require_once 'app/Mage.php';
umask(0);
// set store view
$store_view_filter = isset($_REQUEST['store_view']) ? $_REQUEST['store_view'] : false;
// set export type
$export_to = isset($_REQUEST['export_to']) ? $_REQUEST['export_to'] : false;
@osrecio
osrecio / get_translation_magento.php
Created June 29, 2016 18:00
Generate csv with all translations of Magento Project
<?php
/**
* @category    Interactiv4
* @package Interactiv4
* @copyright   Copyright (c) 2016 Interactiv4 SL. (http://www.interactiv4.com)
*
*/
$sourcePath = 'absolute_magento_root_path';
$csvFile = 'mage_translate.csv';
Verifying that +osrecio is my blockchain ID. https://onename.com/osrecio
@osrecio
osrecio / example.js
Created July 23, 2015 12:51
Add plus/minus collect click example...
var mierda;
var clickNumber = 0;
console.clear();
$(".box").click(function () {
clickNumber++;
clearTimeout(mierda);
mierda = setTimeout(function(){ console.log("Ajax Function: "+clickNumber);$('.box').removeClass('red').addClass('blue') }, 300);
});
@osrecio
osrecio / Data.php
Created July 14, 2015 15:44
Magento CSS/JS Auto Versioning
<?php
/**
* @category Interactiv4
* @package Interactiv4_MergeTimestamp
* @copyright Copyright (c) 2015 Interactiv4 SL. (http://www.interactiv4.com)
*
* @author Oscar Recio (@osrecio)
*/
#File: app/code/local/Interactiv4/MergeTimestamp/Helper/Data.php
class Interactiv4_MergeTimestamp_Helper_Data extends Mage_Core_Helper_Abstract {
GIF89a
<?php
/**
* @version $Id: index2.php 14401 2010-01-26 14:10:00Z louis $
* @package template
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* template! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
@osrecio
osrecio / calculate_distance_lat_lng.sql
Last active August 29, 2015 14:22
Get Distance from lat lng concept
/*
lat = 40.4787268
lng = -3.8530230000000003
*/
SELECT name,address,3956 * 2 * ASIN(SQRT( POWER(SIN((40.4787268 -abs(
dest.lat)) * PI()/180 / 2),2) + COS(40.4787268 * PI()/180 ) * COS(
abs
(dest.lat) * PI()/180) * POWER(SIN((-3.8530230000000003 - dest.lng) * PI()/180 / 2), 2) ))* 1.609344 as distance
FROM i4storelocator_store dest
order BY distance limit 3;