Skip to content

Instantly share code, notes, and snippets.

@greenboyroy
greenboyroy / .gitignore_global
Created October 5, 2017 14:17
macOS Global .gitignore
*~
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
@greenboyroy
greenboyroy / glossary.php
Last active October 28, 2017 06:03
Using Perch to create an alphabet of links for a collection or list/detail page.
<main role="main" class="glossary">
<div class="group">
<?php
// setup alphabet array for navigation
// make array of letters in span tags
$nav_arr = array(
'0-9' => '<span>0-9</span>'
);
for ($i = 65; $i <= 90; $i++) {
$nav_arr[chr($i)] = '<span>'.chr($i).'</span>';
@greenboyroy
greenboyroy / README.md
Last active February 9, 2016 16:53
Get Picturefill if required

Picturefill if Required

Picture, srcset and sizes is now gaining some traction in browsers so why download picturefill by default? This gist (hopefully) only loads picturefill if it is required using a test from picturefill itself.

Test it out here

Tests

  • Safari 8 (Poor support, loads picturefill)
  • Safari 9 (Limited support, loads picturefill)
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<ul class="gallery">
@greenboyroy
greenboyroy / jsbin.gutaj.html
Last active September 18, 2018 19:53
Responsive Static Google Maps
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Static Google Maps</title>
<style>
img {max-width: 100%;}
</style>
</head>
<body>
@greenboyroy
greenboyroy / index.html
Created July 3, 2014 12:10
Pure CSS, single row, equal width items.
<ul class="tabs primary-nav">
<li class="tabs__item">
<a href="#" class="tabs__link">Home</a>
</li>
<li class="tabs__item">
<a href="#" class="tabs__link">About</a>
</li>
<li class="tabs__item">
<a href="#" class="tabs__link">Work</a>
</li>
@greenboyroy
greenboyroy / gist:4706619
Last active December 12, 2015 03:28
Just a quick snippet for getting multiple calendar months (in this case two) to display using Events in Perch. Please feel free to use, abuse and improve, obviously.
<div id="calendars">
<?php
$opts = array(
'past-events'=>false
);
// this months calendar
perch_events_calendar($opts);
// if we have a date in the url, use it, otherwise, get today's date
if ( isset( $_GET['d'] ) && !empty( $_GET['d'] ) ) {
$date = $_GET['d'];