Skip to content

Instantly share code, notes, and snippets.

<?php
function grizzly_colors($presets) {
$grizPresets = array(
'color-presets' => array(
'primary' => '#672965',
'primary-90' => '#6E4B69',
'primary-80' => '#8D7A8A',
'primary-70' => '#B3A7AD',
var aniEnd = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
$('.some-els').bind(aniEnd, function(){
// Do something!
$(this).removeClass('animation-class');
});
@brettsnippets
brettsnippets / acf-flexible.php
Created July 25, 2014 16:34
Flexible Content ACF
<?php
// check if the flexible content field has rows of data
if( have_rows('flexible_content_field_name') ):
// loop through the rows of data
while ( have_rows('flexible_content_field_name') ) : the_row();
if( get_row_layout() == 'paragraph' ):
@brettsnippets
brettsnippets / svg.html
Created May 22, 2014 23:27
Cross Browser SVG
<img data-png="potato.png" data-svg="potato.svg">
<noscript><img src="potato.png" alt="Heyo, my potato!"></noscript>
<script>
if (!Modernizr.svg) {
$('img[data-svg$=svg]').each(function(index, item) {
var png = $(item).attr('data-png');
$(item).attr('src', png);
});
@brettsnippets
brettsnippets / vimeo-youtube-screenshot.php
Created May 1, 2014 23:37
Returns Screenshot from Vimeo and Youtube.
function video_image($url){
if(preg_match('/youtu\.be/i', $url) || preg_match('/youtube\.com\/watch/i', $url)){
preg_match('/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/', $url, $matches);
return "http://img.youtube.com/vi/".$matches[7]."/0.jpg";;
} else if(preg_match('/vimeo\.com/i', $url)){
preg_match('/\/\/(www\.)?vimeo.com\/(\d+)($|\/)/', $url, $matches);
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/".$matches[2].".php";));
return $hash[0]["thumbnail_large"];
}
}
@brettsnippets
brettsnippets / .hgignore
Created April 23, 2014 18:32
Sample .hgignore file.
^DATA$
^.idea$
^wp-config.php$
^media$
^stats$
^wp-content/w3tc-config$
^wp-content/cache$
syntax: glob
wp-content/advanced-cache.php
wp-content/object-cache.php
@brettsnippets
brettsnippets / _mixins.less
Created March 10, 2014 22:32
Base Mixins
// Mixins
.font-size(@sizeValue: 1.4) {
@remValue: @sizeValue;
@pxValue: (@sizeValue * 10);
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
}
@brettsnippets
brettsnippets / _variables.less
Created March 10, 2014 22:31
Starter Variables
// Variables
// Fonts
@baseFont: 'PT Sans', 'Helvetica', Arial,sans-serif;
@fontHeading: 'Arvo', 'Georgia', 'Times New Roman', serif;
@fontSecondary: 'Ubuntu', 'Helvetica', Arial, sans-serif;
@fontTertiary: 'Courier', sans-serif;
@baseFontSize: 14px;
@baseFontLineHeight: 1.5em;
@brettsnippets
brettsnippets / product-attributes.php
Created December 31, 2013 23:07
Magento - Echos Product Attributes
<?php echo $_helper->productAttribute($_product, $_product->getHighlights(), 'highlights') ?>
@brettsnippets
brettsnippets / twitter-timeline.js
Created November 27, 2013 08:22
Twitter Timeline - Client Side JS
<div id="twitterfeed" class="twitterfeed"></div>
<script>
/*********************************************************************
* #### Twitter Post Fetcher v10.0 ####
* Coded by Jason Mayes 2013. A present to all the developers out there.
* www.jasonmayes.com
* Please keep this disclaimer with my code if you use it. Thanks. :-)
* Got feedback or questions, ask here:
* http://www.jasonmayes.com/projects/twitterApi/