Skip to content

Instantly share code, notes, and snippets.

fbrnc /
Created Nov 26, 2012
Phpmyadmin configuration
$cfg['MaxTableList'] = 1000;
$cfg['ThemeDefault'] = 'original';
fbrnc / gist:4218909
Created Dec 5, 2012
Magento Cache Warming
View gist:4218909
for i in `cat tmp.urls`
  do echo $i
  URLHOSTNAME=`echo "$i" | sed -e 's@.*//\([^/]*\)/*.*@\1@'`
  URLPATH=`echo "$i" | sed -e 's@.*//[^/]*\(/*.*\)@\1@'`
  for varnish in 'varnish1hostname varnish2hostname'; do
curl -H "Accept-Encoding: gzip, deflate" -H "Host: ${URLHOSTNAME}" -s -X GET -I http://$varnish/$URLPATH | egrep 'HTTP/|Age:|X-Cache'
fbrnc / resources.js
Created Nov 17, 2015
PhantomJS snippet that lists (and counts) all domains that are being accessed during a request
View resources.js
var page = require('webpage').create();
function extractDomain(url) {
var domain = (url.indexOf("://") > -1) ? url.split('/')[2] : url.split('/')[0];
domain = domain.split(':')[0];
return domain;
var domains = {};
View cfn-response.js
exports.SUCCESS = "SUCCESS";
exports.FAILED = "FAILED";
exports.send = function(event, context, responseStatus, responseData, physicalResourceId) {
var responseBody = JSON.stringify({
Status: responseStatus,
Reason: "See the details in CloudWatch Log Stream: " + context.logStreamName,
PhysicalResourceId: physicalResourceId || context.logStreamName,
fbrnc / gist:4760571
Created Feb 12, 2013
Create sku to id lookup table (as csv)
View gist:4760571
mysql -hHOST -uUSER -pPASS DBNAME -e 'select sku, entity_id from catalog_product_entity' -B | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > skuToId.csv
fbrnc / gist:5122610
Created Mar 9, 2013
.htaccess additions for Magento devboxes
View gist:5122610
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_value error_log /var/www/magentoplayground/devbox/htdocs/var/log/php_errors.log
# Also don't forget to copy errors/local.xml.sample to errors/local.xml
fbrnc / gist:5136748
Created Mar 11, 2013
Install xdebug 2.2.1 (which is not available in the Ubuntu 12.04 package repository but required to use xdebug with symlinks/modman)
View gist:5136748
tar -xzvf xdebug-2.2.1.tgz
cd xdebug-2.2.1
./configure --enable-xdebug
sudo make
sudo make install
sudo service apache2 restart
fbrnc / gist:5399929
Created Apr 16, 2013
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:
View gist:5399929
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 / Add hostname to hosts file
Last active Dec 16, 2015
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("",…
View Add hostname to hosts file
$ sudo vi /etc/hosts
# make sure your hostname goes in the first line localhost.localdomain localhost addyourhostnamehere
View fix-sample-data.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.