Skip to content

Instantly share code, notes, and snippets.

@millejano
millejano / Git push deployment in 7 easy steps.md
Created October 9, 2016 07:49 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@millejano
millejano / Makefile
Created October 9, 2016 07:43 — forked from hapticdata/Makefile
use a Makefile to run ssh commands on a vagrant box
SERVER_DIR=/var/www/host/server
CONSOLE=$(SERVER_DIR)/app/console
update:
vagrant ssh -- "cd $(SERVER_DIR) && \
sudo composer selfupdate -n -v && \
composer install -n -v"
cache:
vagrant ssh -- "$(CONSOLE) doctrine:migrations:migrate -n && \
@millejano
millejano / siege_examples.sh
Created July 27, 2016 09:23 — forked from rob-murray/siege_examples.sh
Siege examples
# Basic example
siege -t60s -c20 -d10 'http://robertomurray.co.uk/'
# Basic auth;
$auth = echo -n 'username:password' | openssl base64
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/'
@millejano
millejano / Mage_Paypal_Block_Standard_Redirect
Created August 17, 2012 12:58
Paypal Standard Redirect Page with Magento Layout (1.7.0.2)
class Mage_Paypal_Block_Standard_Redirect extends Mage_Core_Block_Abstract
{
protected function _toHtml()
{
$standard = Mage::getModel('paypal/standard');
$form = new Varien_Data_Form();
$form->setAction($standard->getConfig()->getPaypalUrl())
->setId('paypal_standard_checkout')
->setName('paypal_standard_checkout')
@millejano
millejano / gist:3149637
Created July 20, 2012 08:33
Magento: show only simple products for Report Products Ordered (Mage_Reports_Model_Resource_Product_Sold_Collection)
/**
* Add ordered qty', but only simple products
*
* @param string $from
* @param string $to
* @return Mage_Reports_Model_Resource_Product_Collection
*/
public function addOrderedQty($from = '', $to = '')
{
$adapter = $this->getConnection();
@millejano
millejano / patchMagentos.sh
Created July 11, 2012 09:30
Patch all Magento versions according to the advisory http://www.magentocommerce.com/blog/comments/important-security-update-zend-platform-vulnerability/, using find instead of locate and a cd $OLDDIR for multiple installations
#!/bin/bash
# CREATE BACKUPS BEFORE RUNNING THIS SCRIPT!
OLDDIR=$(pwd)
for m in $(find . -name "Mage.php" -not -path *var* -not -path *skin* -not -path *media* | grep -v downloader); do
cd $OLDDIR
cd $(dirname $(dirname $m)) || (echo && continue) # old locate db
MAGE_VERSION=$(php -d error_reporting=0 -r "require 'app/Mage.php'; Mage::app(); echo Mage::getVersion();")
#!/bin/bash
# CREATE BACKUPS BEFORE RUNNING THIS SCRIPT!
for m in $(locate Mage.php | grep -v downloader); do
cd $(dirname $(dirname $m)) || (echo && continue) # old locate db
MAGE_VERSION=$(php -d error_reporting=0 -r "require 'app/Mage.php'; Mage::app(); echo Mage::getVersion();")
if echo $MAGE_VERSION | egrep -q "^[0-9.]+$"; then
if [ $MAGE_VERSION "<" 1.4.0.0 ] || [ $MAGE_VERSION ">" 1.7.0.1 ]; then
echo -e "No patch available for version $MAGE_VERSION in $(pwd)\n"
@millejano
millejano / Magento Subcategories via a Static Block
Created June 28, 2012 13:00
Magento Subcategories via a Static Block
<?php
/**
* NOTICE OF LICENSE (MIT License)
*
* Copyright (c) 2009, One Eighty Studios Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@millejano
millejano / Data.php
Created March 26, 2012 08:19
bugfix for tax issue (price has sometimes +0.01) - save in app/code/local/Mage/Tax/Helper/Data.php
<?php
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition License
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magentocommerce.com/license/enterprise-edition