Skip to content

Instantly share code, notes, and snippets.

View aarongustafson's full-sized avatar
👋
he/him/his

Aaron Gustafson aarongustafson

👋
he/him/his
View GitHub Profile
@aarongustafson
aarongustafson / webp-service-worker.js
Created November 20, 2015 20:51 — forked from deanhume/client-hints-service-worker.js
Service Worker & HTTP Client Hints
"use strict";
self.addEventListener('fetch', function(event) {
var request = event.request,
url = request.url,
url_object = new URL( url ),
re_jpg_or_png = /\.(?:jpg|png)$/,
supports_webp = false, // pessimism
webp_url;
@aarongustafson
aarongustafson / gist_tag.rb
Last active January 2, 2017 14:29 — forked from BinaryMuse/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
# A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
# by: Brandon Tilly
# Source URL: https://gist.github.com/1027674
# Post http://brandontilley.com/2011/01/31/gist-tag-for-jekyll.html
#
# Example usage: {% gist 1027674 gist_tag.rb embed %} //embeds a gist for this plugin
require 'cgi'
require 'digest/md5'
require 'net/https'
...
// test for font-face version to load via Data URI'd CSS
// Basically, load WOFF unless it's android's default browser, which needs TTF, or ie8-, which needs eot
var fonts = ns.files.css.fontsWOFF,
ua = win.navigator.userAgent;
// android webkit browser, non-chrome
if( ua.indexOf( "Android" ) > -1 && ua.indexOf( "like Gecko" ) > -1 && ua.indexOf( "Chrome" ) === -1 ){
fonts = ns.files.css.fontsTTF;
}