This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Config | |
{ | |
/** | |
*@var array | |
*/ | |
private static $config = null; | |
/** | |
* Returns a config setting. | |
* @param string $name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$setId = $_product->getAttributeSetId(); // Attribute set Id | |
$groups = Mage::getModel('eav/entity_attribute_group') | |
->getResourceCollection() | |
->setAttributeSetFilter($setId) | |
->setSortOrder() | |
->load(); | |
$attributeCodes = array(); | |
foreach ($groups as $group) { | |
if($group->getAttributeGroupName() == 'Somename'){ // set name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get attribute value, where 'technical_pdf' is attribute code | |
$_technical_pdf = $_product->getResource()->getAttribute('technical_pdf')->getFrontend()->getValue($_product); | |
//Get attribute frontend store label | |
$label = $_product->getResource()->getAttribute('attribute_code')->getStoreLabel(); | |
//Get attribute value | |
$attribute_value = $_product->getAttributeText($attributeCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Check integrity */ | |
SELECT c.entity_id, c.children_count as original_children_count, COUNT(c2.children_count) as `children_count`, c.level as original_level, (LENGTH(c.path)-LENGTH(REPLACE(c.path,'/',''))) as `level` | |
FROM mage_catalog_category_entity c | |
LEFT JOIN mage_catalog_category_entity c2 ON c2.path like CONCAT(c.path,'/%') | |
GROUP BY c.path | |
/** Fix child counts */ | |
UPDATE mage_catalog_category_entity SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM mage_catalog_category_entity) AS table2 WHERE path LIKE CONCAT(mage_catalog_category_entity.path,"/%")); | |
/** more info */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Copyright 2012 Armand Niculescu - MediaDivision.com | |
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
* THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fireGaEvent(category, action, label, value) | |
{ | |
if (null === category) { | |
category = 'Professional Learning'; | |
} | |
if (ga) { | |
if (value !== undefined && value !== '') { | |
ga('send', 'event', category, action, label, value); | |
} else { | |
ga('send', 'event', category, action, label); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Check for opcode caching (APC), built into PHP 5.5+, check it is enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To tell RabbitMQ to instruct Erlang to communicate on a certain range of ports, create a file at /etc/rabbitmq/rabbitmq.config with the following contents: | |
[ | |
{kernel, [{inet_dist_listen_min, 9100},{inet_dist_listen_max, 9105}]} | |
]. | |
#Now for the iptables configuration. Update /etc/sysconfig/iptables with the following rules: | |
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5672 -j ACCEPT | |
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4369 -j ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://ipecho.net/plain -O - -q ; echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nr_work_days = getWorkingDays('2014-05-01','2014-05-06', null); | |
echo $nr_work_days; | |
/** | |
* Calculate the number of working days between two dates. | |
* Note: The result is inclusive of the start and end date. Given two adjacent weekday dates the result is 2 | |
* Return 0 if the start date is greater than the end date | |
* @param string $startDate Starting date | |
* @param string $endDate End date | |
* @param array $additional_holidays Additional holidays to remove from the calculation |
OlderNewer