Skip to content

Instantly share code, notes, and snippets.

@octoxan
octoxan / heightLogger.js
Created July 8, 2016 17:50
Target Height Logger
$(document).on('click', function(e) {
console.log('my height is ' + $(e.target).height());
console.log('my outerHeight is ' + $(e.target).outerHeight());
});
@octoxan
octoxan / layout.xml
Last active June 24, 2016 17:37
Add Class to <body> in Magento
<reference name="root">
<action method="addBodyClass"><classname>whatever</classname></action>
</reference>
@octoxan
octoxan / MagentoSnippets.md
Created March 29, 2016 12:31 — forked from discountscott/MagentoSnippets.md
Magento Snippets

Magento Snippets

Clear cache/reindex

<?php
// clear cache
Mage::app()->removeCache('catalog_rules_dirty');
// reindex prices
Mage::getModel('index/process')->load(2)->reindexEverything();
@octoxan
octoxan / responsive-frames.js
Last active April 11, 2017 15:02
Responsive iframes
jQuery(function ($) {
$(document).ready(function () {
if (typeof IFRAME_MARGIN == 'undefined') {
IFRAME_MARGIN = 5;
}
$('iframe').each(function (index, item) {
if ($(item).attr('src').match(/iframebasedomaingoeshere/)) {
//eg for a youtube video just replace the above with youtube
var w = $(item).attr('width');
var h = $(item).attr('height');
@octoxan
octoxan / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console