Skip to content

Instantly share code, notes, and snippets.

@brettsnippets
brettsnippets / sass-media-query-mixin
Created November 26, 2013 06:13
SASS - Media Query Mixin
// Named Media Query
@mixin breakpoint($point) {
@if $point == desktop {
@media (min-width: 1200px) { @content; }
}
@else if $point == tablet {
@media (min-width: 768px) and (max-width: 1024px) { @content; }
}
@else if $point == phone {
@media (max-width: 767px) { @content; }
@brettsnippets
brettsnippets / sass-retina-mixin.scss
Created November 26, 2013 06:13
SASS - Retina Image Mixin
// retina images
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
/* on retina, use image that's scaled by 2 */
background-image: url($image);
background-size: $width $height;
@brettsnippets
brettsnippets / magento-skin-url.php
Created November 20, 2013 18:52
Magento Skin Url
<?php echo $this->getSkinUrl('images/sampleimage.jpg') ?>
@brettsnippets
brettsnippets / static-block.php
Created October 16, 2013 15:51
Magento - Static Block to Insert into phtml files
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('my-block-id')->toHtml(); ?>
@brettsnippets
brettsnippets / gravity-hook.js
Created October 11, 2013 23:29
Gravity Forms Validation Hook
$(document).on('gform_page_loaded', function(){
console.log('whatever is within this function, is executed on the loading of the validation message')
});
@brettsnippets
brettsnippets / instagram-feed.php
Created October 1, 2013 17:09
Instagram Feed
<?php
// Supply a user id and an client id
$userid = "xxxxx";
$clientid = "xxxxx"; // This can stay the same
// Gets our data
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@brettsnippets
brettsnippets / acf-image-size.php
Created September 3, 2013 19:16
ACF Image Size Specific
$image = wp_get_attachment_image(get_sub_field('slideshow_image'), 'homepage_banner');
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 8
);
$news = new WP_Query($args);
if ($news->have_posts()):
while ($news->have_posts()): $news->the_post();
add_image_size( 'name', width, height, crop );
@brettsnippets
brettsnippets / gravity-form-shortcode.php
Created July 30, 2013 17:23
Gravity Form Shortcode
[gravityform id="1" name="Example Form" title="false" description="false" ajax="true"]