Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bavington
bavington / jw-schema.html
Last active August 29, 2015 14:03
Schema.org Video Markup for JW Player
<div id="myElement" itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
<h2 itemprop="name">Video Name or Title</h2>
<meta itemprop="duration" content="00:02:33" />
<meta itemprop="thumbnailUrl" content="http://example.com/uploads/myPoster.jpg" />
<meta itemprop="contentUrl" content="http://example.com/uploads/myVideo.mp4" />
<meta itemprop="uploadDate" content="2014-01-03T08:00:00+08:00" />
<span itemprop="description">The description of your video content goes here.</span>
<script>
jwplayer("myElement").setup({
file: "http://example.com/uploads/myVideo.mp4",
@bavington
bavington / jw-video-sitemap.xml
Last active August 29, 2015 14:03
JW Player supporting Video XML Sitemap
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>http://example.com/page-with-video.html</loc>
<video:video>
<video:thumbnail_loc>http://example.com/uploads/myPoster.jpg</video:thumbnail_loc>
<video:title>Video Name or Title</video:title>
<video:description>The description of your video content goes here.</video:description>
<video:content_loc>http://example.com/uploads/myVideo.mp4</video:content_loc>
<video:duration>153</video:duration>
@bavington
bavington / gist:b7d3fd2e321770beecdd
Created September 30, 2014 10:38
Magento Multi-site htaccess
RewriteCond %{HTTP_HOST} ^.*orderofficefurniture\.co\.uk
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.orderofficefurniture.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^.*orderbeds\.co\.uk
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.orderbeds.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^.*big-av\.co\.uk
RewriteCond %{THE_REQUEST} ^.*/index.php
@bavington
bavington / magento-layout.xml
Last active August 29, 2015 14:09
Magento Layout XML Snippets
<!-- Adding JS or CSS -->
<reference name="head">
<!-- Using add Method -->
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<!-- Using addItem Method -->
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
</reference>
@bavington
bavington / woo_reg_price.php
Created December 15, 2014 20:47
WooCommerce Getting the Regular Price
$regular_price = get_post_meta( get_the_ID(), '_regular_price', true);
if ($regular_price == ""){
$available_variations = $product->get_available_variations();
$variation_id=$available_variations[0]['variation_id'];
$variable_product1= new WC_Product_Variation( $variation_id );
$regular_price = $variable_product1 ->regular_price;
}
echo $regular_price;
@bavington
bavington / magento-bits.php
Created December 17, 2014 22:46
Magento PHP Bits
<?php
$_product->getData('width'); // Get Attribute value (numeric)
$_product->getAttributeText('range'); // Get Attribute value (dropdown)
?>
@bavington
bavington / translate-fix-mage.xml
Created January 11, 2015 14:57
Magento Local Development Translate Inline Fix
<!-- Add to Local.xml -->
<default>
<reference name="footer">
<block type="core/text" name="translatefix">
<action method="setText">
<text>
<![CDATA[
<script>
if(Object.__defineGetter__)
{
@bavington
bavington / woo_disqus.php
Created June 7, 2015 16:11
Function to Add DISQUS to WooCommerce product pages.
function disqus_embed($disqus_shortname) {
global $post;
wp_enqueue_script('disqus_embed','http://'.$disqus_shortname.'.disqus.com/embed.js');
echo '<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "'.$disqus_shortname.'";
var disqus_title = "'.$post->post_title.'";
var disqus_url = "'.get_permalink($post->ID).'";
var disqus_identifier = "'.$disqus_shortname.'-'.$post->ID.'";
</script>';
@bavington
bavington / vertical_rhythm.sass
Created August 13, 2015 19:44
Vertical Rhythm
$fz-mobile: percentage(28/1.6/16);
$fz-desktop: percentage(32/1.6/16);
$lh: 1.6rem;
$h1: 2rem;
$h2: 1.5rem;
$h3: 1.25rem;
$h4: 1rem;
$h5: .875rem;
@bavington
bavington / retinize.scss
Created May 1, 2014 12:16
Retinize SASS Mixin
$is-hidpi:" (-webkit-min-device-pixel-ratio: 1.5),
(min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx)";
@mixin retinize($file, $type){
background-image: url('images/' + $file + '.' + $type);
@media #{$is-hidpi}{