View all_attribute_options
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance) {
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
View Add swap
root@myserver:~# dd if=/dev/zero of=/swap.dat bs=1024 count=512k
root@myserver:~# mkswap /swap.dat
root@myserver:~# swapon /swap.dat
root@myserver:~# vim /etc/fstab
vim is started to edit, add the following to the end of /etc/fstab file
/swap.dat none swap sw 0 0
Then, edit the mysql config file
root@myserver:~# vim /etc/mysql/my.cnf
View exportMysqlUsers.php
* Export MySQL users and permissions
* This script exports raw CREATE USER and GRANT queries of a given database
* to help migrate MySQL users and permissions to a new server.
* Users will keep their passwords across the migration.
* Warning: The import queries expects exactly the same database structure!
View UploadHandlerS3.php
use Aws\Common\Aws;
use Aws\S3\Exception\S3Exception;
// make sure the SDK is installed
// I've used Composer to autoload it:
* jQuery File Upload Plugin PHP Class 7.1.0
View gist:85bfbe8143ded6a30acb
$locale = 'nl_NL';
Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
View gist:17f6a800960955e7b40e
function toUnicode(theString) {
var unicodeString = '';
for (var i=0; i < theString.length; i++) {
var theUnicode = theString.charCodeAt(i).toString(16).toUpperCase();
while (theUnicode.length < 4) {
theUnicode = '0' + theUnicode;
theUnicode = '\\u' + theUnicode;
unicodeString += theUnicode;
View gist:8ef76eb48a2ca3f0cf59
* go to to create your access-token. The token will look somewhat like this:
* xoxo-2100000415-0000000000-0000000000-ab1ab1
public static function slack($message, $channel) {
$ch = curl_init("");
$data = http_build_query([

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
View gist:b31f8c6ad4998c0e1a39
/*********Start Pepperjam Network Codes #1 ******/
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$_totalData = $order->getData();
$_currency = $_totalData['order_currency_code'];
$_productData = $order->getAllItems();