Skip to content

Instantly share code, notes, and snippets.

View rjv's full-sized avatar

Roger Vandawalker rjv

View GitHub Profile
document.querySelectorAll('[target=_blank]').forEach(function(target) {
target.setAttribute("rel", "noopener noreferrer");
});
@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;
}
@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 / gist:9092930
Created February 19, 2014 14:13
Ignore IE9 and below with a CSS selector. Anything with the .new-amazingness class will not apply to IE9 and below.
.new-amazingness:not(:required) {
/* hide boring defaults */
/* show modern amazingness */
}
@rjv
rjv / external-new-window
Last active January 2, 2016 17:38
Open external links in a new window
// create custom selector for external links
$.expr[':'].external = function(obj){
var $this = $(obj);
return !$this.is('[href^="mailto:"]') && !$this.is('[href^="javascript:"]') && (obj.hostname != location.hostname) && ($this.data('target') != "top");
};
// DOM is ready
$(function(){
// apply target="_blank" to each external link on the page
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@rjv
rjv / gist:5372014
Created April 12, 2013 13:32
Clone Laravel 4 develop branch into current directory
git clone -o laravel -b develop https://github.com/laravel/laravel.git .
@rjv
rjv / gist:5067369
Created March 1, 2013 20:08
Sitefinity Banners widget template
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Fields" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
<LayoutTemplate>
@rjv
rjv / gist:5058223
Created February 28, 2013 16:59
Binding a jQuery click w/Google Analytics event tracking
$(document)
.on("click", "a", function(){
track('My-Category', 'My-Name', 'My-Value');
});
@rjv
rjv / gist:4949703
Created February 14, 2013 00:30
Stripped HTML5 Boilerplate
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">