Skip to content

Instantly share code, notes, and snippets.

View fbrnc's full-sized avatar

Fabrizio Branca fbrnc

  • AOE
  • Wiesbaden, Germany
  • X @fbrnc
View GitHub Profile
@fbrnc
fbrnc / gist:5136748
Created March 11, 2013 19:02
Install xdebug 2.2.1 (which is not available in the Ubuntu 12.04 package repository but required to use xdebug with symlinks/modman)
wget http://xdebug.org/files/xdebug-2.2.1.tgz
tar -xzvf xdebug-2.2.1.tgz
cd xdebug-2.2.1
phpize
./configure --enable-xdebug
sudo make
sudo make install
sudo service apache2 restart
@fbrnc
fbrnc / gist:5399929
Created April 16, 2013 21:46
If your images are not rendering check you php memory_limit settings. Magento doesn't support the "1G" notation. Apply this fix to your sources:
Index: lib/Varien/Image/Adapter/Gd2.php
===================================================================
--- lib/Varien/Image/Adapter/Gd2.php (revision 143037)
+++ lib/Varien/Image/Adapter/Gd2.php (revision 143038)
@@ -82,7 +82,9 @@
*/
protected function _convertToByte($memoryValue)
{
- if (stripos($memoryValue, 'M') !== false) {
+ if (stripos($memoryValue, 'G') !== false) {
@fbrnc
fbrnc / Add hostname to hosts file
Last active December 16, 2015 12:49
Sending mails in php is slow on your dev machine? Add the hostname to the first line (where "localhost" is) in /etc/hosts. For some reason adding a separate line for your hostname does not have any effect. Find our what your hostname is using "hostname" on commandline. Quick test from command line: php -r 'mail("insertyourmailaddress@gmail.com",…
$ sudo vi /etc/hosts
# make sure your hostname goes in the first line
127.0.0.1 localhost.localdomain localhost addyourhostnamehere
...
<?php
/**
* Drop this into the shell directory in the Magento root and run without any arguments.
*/
require_once 'abstract.php';
/**
* Clean up the 1.6.1 sample data to work with the 1.8 CE url key constraints.
@fbrnc
fbrnc / gist:5514427
Created May 3, 2013 21:38
Install apc.php monitor
$ sudo cp /usr/share/doc/php-apc/apc.php.gz /var/www
$ sudo gzip -d /var/www/apc.php.gz
$ sudo vim /var/www/apc.php
# Change credentials near line 41:
defaults('ADMIN_USERNAME','apc'); // Admin Username
defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!
@fbrnc
fbrnc / gist:5535608
Created May 7, 2013 19:56
Add svn:external via command line
svn propget svn:externals > tmp
echo "http:... ExternalName" >> tmp
svn propset svn:externals -F tmp .
svn commit --depth empty . -m "Added external"
@fbrnc
fbrnc / gist:5548318
Last active December 17, 2015 04:08
Advanced exception stack trace with untruncated parameters and remote call links
<?php
final class Mage {
/**
* Get advanced exception trace
*
* @param Exception $exception
* @return string
*/
@fbrnc
fbrnc / gist:5548375
Created May 9, 2013 15:58
C:\Users\<USER>\AppData\Roaming\Mozilla\Firefox\Profiles\<PROFILE>\chrome\userContent.css
pre, code {
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
}
@fbrnc
fbrnc / gist:5579585
Created May 14, 2013 21:12
Adding Varien_Profiler statements for easier Profiling using Aoe_Profiler
<?php
class Mage_Core_Block_Abstract {
public function getChildHtml($name='', $useCache=true, $sorted=false)
{
Varien_Profiler::start('getChildHtml: '.$name);
if ('' === $name) {
if ($sorted) {
$children = array();
@fbrnc
fbrnc / gist:5672325
Created May 29, 2013 17:59
~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[1~": beginning-of-line
"\e[4~": end-of-line