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 | |
function checkStock($url,$sku,$size, $nick = null){ | |
$content = file_get_contents($url); | |
$find = $sku.'":["<span class'; | |
$start = strpos($content,$find); | |
$end = strpos($content,"]]",$start); | |
$substr = substr($content,$start,$end-$start); | |
if (strpos($substr,$size) !== false){ |
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 validateEmail(email) { | |
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; | |
return re.test(email); | |
} |
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
varnishadm | |
vcl.load reload01 /usr/local/etc/varnish/default.vcl | |
vcl.use reload01 | |
varnishadm "ban.url ." # Matches all URLs | |
varnishadm "ban req.http.host == opensourcehacker.com" |
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
#!/bin/bash | |
export XDEBUG_CONFIG="idekey=PHPSTORM" && | |
export PHP_IDE_CONFIG="serverName=Unnamed" && | |
php "$@" | |
Also put this into | |
/etc/php/5.6/fpm/conf.d/20-xdebug.ini | |
xdebug.remote_host=192.168.56.1 |
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
update core_config_data | |
set value = replace(value, 'intl.forever', 'oscarintl.forever') | |
where value like '%intl.forevernew%'; -- this is so the query doesn't spend time checking all other rows |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<?xml version="1.0"?> | |
<config> | |
<frontend> | |
<events> | |
<!--disable logs--> | |
<controller_action_predispatch> | |
<observers><log><type>disabled</type></log></observers> | |
</controller_action_predispatch> | |
<controller_action_postdispatch> | |
<observers><log><type>disabled</type></log></observers> |
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 | |
/** | |
* Copy all images from $productSrc to $productDest | |
* | |
* @param Mage_Catalog_Model_Product $productSrc | |
* @param Mage_Catalog_Model_Product $productDest | |
*/ | |
public function copyProductImages(Mage_Catalog_Model_Product $productSrc, Mage_Catalog_Model_Product $productDest) | |
{ | |
$images = array(); |
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
SELECT * FROM ( SELECT | |
ce.sku, | |
ea.attribute_id, | |
ea.attribute_code, | |
CASE ea.backend_type | |
WHEN 'varchar' THEN ce_varchar.value | |
WHEN 'int' THEN ce_int.value | |
WHEN 'text' THEN ce_text.value | |
WHEN 'decimal' THEN ce_decimal.value | |
WHEN 'datetime' THEN ce_datetime.value |
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 | |
$attribute_code = 'fashion_colour'; | |
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code); | |
$options = $attribute->getSource()->getAllOptions(); | |
$optionsDelete = array(); | |
$optionsValue = array(); | |
foreach($options as $option) { | |
if (in_array($option['label'], $optionsValue)) { | |
$optionsDelete['delete'][$option['value']] = true; | |
$optionsDelete['value'][$option['value']] = true; |
OlderNewer