Skip to content

Instantly share code, notes, and snippets.

@benrobertsonio
benrobertsonio / lazy-video-loader.js
Last active November 4, 2019 22:02
Lazy Loading Video Based on Connection Speed
class LazyVideoLoader {
constructor() {
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo'));
// Abort when:
// - The browser does not support Promises.
// - There no videos.
// - If the user prefers reduced motion.
// - Device is mobile.
if (
@JasonHoffmann
JasonHoffmann / responsive-images.php
Created August 27, 2014 21:10
Responsive Images in WordPress
/*
* Start by creating a few image sizes for us to use
*/
add_image_size('smallest', 479, 9999);
add_image_size('small', 768, 9999);
add_image_size('largest', 1800, 9999);
/*
* Enqueue our Picturefill Javascript
@billerickson
billerickson / display_posts_shortcode_output.php
Created August 27, 2011 16:35
Add Facebook Like to Display Posts Shortcode plugin
<?php
/**
* Add Facebook Button to Display Posts Shortcode plugin
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://wordpress.org/support/topic/facebook-likeshare-button-at-the-end-of-excerpt
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output