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
// detect if naturalWidth property is supported | |
// getting it is much faster than getComputedStyle() | |
var supportsNatural = ( "naturalWidth" in (new Image()) ), | |
imagePath = 'image.jpg', | |
interval, | |
hasSize, | |
onHasSize = function() { | |
if(hasSize) return; | |
var naturalWidth = supportsNatural ? img[0].naturalWidth : img.width(); |
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 | |
$collection = Mage::getModel('review/review')->getCollection() | |
->addStoreFilter(Mage::app()->getStore()->getId()) | |
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED) | |
->setDateOrder(); | |
$collection->getSelect() | |
->join(array('attr' => 'catalog_product_entity_int'), 'attr.entity_id = main_table.entity_pk_value', array('*')) | |
->where('attr.attribute_id = 136') |
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
<div class="touchcarousel"> | |
<ul class="touchcarousel-container"> | |
<li class="touchcarousel-item column"> | |
<img src="1.jpg" width="60" height="60" /> | |
<img src="2.jpg" width="60" height="60" /> | |
<img src="3.jpg" width="60" height="60" /> | |
</li> | |
<li class="touchcarousel-item column"> | |
<img src="4.jpg" width="60" height="60" /> |
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
// Add this to your theme functions.php | |
function add_additional_rs_code() { | |
?> | |
if(window.location.hash.indexOf('video') > -1) { | |
jQuery('body').scrollTo('.royalSlider'); | |
} | |
<?php | |
} | |
add_action('new_rs_after_js_init_code', 'add_additional_rs_code'); |
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
Regular expression cheat sheet for Varnish | |
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX | |
regular expressions, for a complete guide, see: "man 7 regex" | |
Basic matching: | |
req.url ~ "searchterm" | |
True if req.url contains "searchterm" anywhere. | |
req.url == "searchterm" |
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() { | |
function trackJavaScriptError(e) { | |
e = e || window.event; | |
if(!e || !e.message || !e.lineno){ | |
return true; | |
} | |
var errMsg = e.message; | |
var errSrc = e.filename + ': ' + e.lineno; | |
ga('send', 'event', 'JavaScript Error', errMsg, errSrc, { 'nonInteraction': 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
(function() { | |
var homepage = 'example.com', | |
url = window.location.href.toLowerCase(); | |
if(url.indexOf(homepage) === -1) { | |
return; | |
} | |
// tracking code... |
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(template, UiClass, items, options) | |
var self = this; | |
/** | |
* Static vars, don't change unless you know what you're doing. | |
*/ | |
var DOUBLE_TAP_RADIUS = 25, | |
NUM_HOLDERS = 3; |
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
/** | |
* | |
* desktop-zoom.js: | |
* | |
* - Binds mousewheel event for paning zoomed image. | |
* - Manages "dragging", "zoomed-in", "zoom-out" classes. | |
* (which are used for cursors and zoom icon) | |
* - Adds toggleDesktopZoom function. | |
* | |
*/ |
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($) { | |
"use strict"; | |
$.extend($.rsProto, { | |
_initDeeplinking: function() { | |
var self = this, | |
isBlocked, | |
hashTimeout, | |
hashChangeTimeout; |
OlderNewer