Skip to content

Instantly share code, notes, and snippets.

kalenjordan / gist:3901671
Created Oct 16, 2012
Find and mass replace, Find and delete
View gist:3901671
# Delete backup files
find . -name "*.bak" -exec rm {} \;
# Find and mass replace. It creates .bak files, but without the .bak this doesn't work in OSX
find . -exec sed -i.bak s/Find/Replace/g {} \;
# find and replace
ack -l 'Find' | xargs perl -pi -E 's/Find/Replace/g'
View gist:4982293
# Create the directory
cd ~ && mkdir bin
cd ~/bin
# Install composer
curl -s | php
# Clone the repo
git clone magerun
kalenjordan / Batched Iterator for Magento collections
Last active May 9, 2022
Batched iterator for Magento collections
View Batched Iterator for Magento collections
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
public function batchIndividual($model)
View footer.phtml
View gist:6731541
grep "HTTP\/...\" 404" nginx-access.log | awk '{ print $16}' | sort | uniq
kalenjordan /
Last active Dec 24, 2015
Change copyright from 2013 to 2012
kalenjordan / autoloader-benchmark.php
Last active Dec 25, 2015
Autoloading benchmark - loads ~1k classes in order to benchmark the autoloader. I've used this to compare with and without the AOE ClassPathCache autoloader.
View autoloader-benchmark.php
require_once(dirname(__FILE__) . '/../app/Mage.php');
$classesRaw = file_get_contents(dirname(__FILE__) . '/data/classes.txt');
$classes = explode("\n", $classesRaw);
echo "Loading " . count($classes) . " classes\r\n";
View app\code\local\YourCompany\YourModule\etc\system.xml
<?xml version="1.0"?>
View gist:7827914

I'm trying to figure out what the best way is to implement what I'm calling an "addon product".

The way it works is that when a customer adds the Essentials Shakes to their cart, we want to prompt them to add a Shaker Bottle (it's like a bottle that makes it easy to make shakes) to their order as well for $5.

I would have used a grouped product for this, but you can't combine configurable and grouped products, plus there are issues with subscription orders as well.

So what I'm leaning towards now is maybe a modal that pops up after they add the Essentials to their cart which prompts them to add this other product to their cart.

Somebody has to have run into this use case before.

View gist:7936461
Gmail: Hey, we're caching images now, it's more secure b/c suckas can't inject nastiness on you.
JS: Liars! You're totally making it sound like you're improving privacy by no longer allowing email marketers to track opens using images.
Gmail: But....all we said was we're improving security
JS: Now that's just splitting hairs!