Skip to content

Instantly share code, notes, and snippets.

View rjv's full-sized avatar

Roger Vandawalker rjv

View GitHub Profile
@mixin rem($property, $values) {
// Create a couple of empty lists as output buffers.
$base-font-size: 16px; // should be consistent with your html/body font-size
$px-values: ();
$rem-values: ();
// Loop through the $values list
@each $value in $values {
// For each property value, if it's in rem or px, derive both rem and
// px values for it and add those to the end of the appropriate buffer.
@rjv
rjv / functions.php
Last active February 13, 2018 19:45
Helper function for getting the featured image URL attached to a post (WordPress)
<?php
function get_thumbnail_url($post_id = null, $size = 'medium')
{
global $post;
if (is_string($post_id)) {
$size = $post_id;
$post_id = $post->ID;
}
document.querySelectorAll('[target=_blank]').forEach(function(target) {
target.setAttribute("rel", "noopener noreferrer");
});