Skip to content

Instantly share code, notes, and snippets.

View budparr's full-sized avatar
🎯
Focusing

Bud Parr budparr

🎯
Focusing
View GitHub Profile
@budparr
budparr / bourbon-headers-scale
Created May 3, 2015 04:54
Automatically scale header font sizes in Bourbon/Bitters
@for $i from 1 through 6 {
h#{$i} {
font-size: modular-scale((6 - $i), 1em, 1.2);
}
}
// via https://github.com/thoughtbot/bitters/issues/153#issuecomment-85744338
@budparr
budparr / gist:103dcd0f3dbd6615761b
Created May 4, 2015 16:49
Webhook Prefetch for Prev/Next items
Place this in your head.
{% block head_extra %}
{% set prev = prevItem(item, 'publish_date', true) %}
{% set next = nextItem(item, 'publish_date', true) %}
{% if prev %}
<link rel="prefetch" href="{{ url(prev) }}" />
{% endif %}
{% if next %}
<link rel="prefetch" href="{{ url(next) }}" />
{% endif %}
@budparr
budparr / Isotope Issues with Combination Filters and Hash State (solved).markdown
Last active August 29, 2015 14:21
Isotope Issues with Combination Filters and Hash State (solved)
{% comment %}
*
* http://stackoverflow.com/questions/9612235/what-are-some-good-ways-to-implement-breadcrumbs-on-a-jekyll-site
*
{% endcomment %}
<nav class="breadcrumbs" role="menubar" aria-label="breadcrumbs">
<a href="{{ site.url }}">{{ site.data.language.breadcrumb_start }}</a>
{% assign crumbs = page.url | split: '/' %}
{% for crumb in crumbs offset: 1 %}
@budparr
budparr / jekyll-collections-config-value.liquid
Last active January 25, 2016 03:26
get a config defined variable for a collectionhttps://github.com/jekyll/jekyll/issues/4392#issuecomment-174369983
If I have a _config.yml with:
collections:
my_collection:
foo: bar
And a template with
```
{% assign collectionName = 'my_collection' %}
@budparr
budparr / index.html
Last active March 24, 2016 01:28
Test block
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>D3 </title>
<style media="screen">
svg {
border: 1px solid #f0f;
}
{% for link_hash in page.links %}
{% for link in link_hash %}
<a href="{{ link[1] }}">{{ link[0] }}</a>
{% endfor %}
{% endfor %}
@budparr
budparr / jekyll-error-comparison of Jekyll::Document with Jekyll::Document failed
Last active April 7, 2016 03:19
comparison of Jekyll::Document with Jekyll::Document failed
Generating...
Liquid Exception: Liquid error (line 67): comparison of Jekyll::Document with Jekyll::Document failed in _layouts/case.html
/Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/strainer.rb:56:in `rescue in invoke': Liquid error (line 67): comparison of Jekyll::Document with Jekyll::Document failed (Liquid::ArgumentError)
from /Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/strainer.rb:50:in `invoke'
from /Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/context.rb:95:in `invoke'
from /Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/variable.rb:88:in `block in render'
from /Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/variable.rb:86:in `each'
from /Users/budparr/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/liquid-3.0.6/lib/liquid/variable.rb:86:in `inject'
from /Users/budparr/.rbenv/versions/2.1.3/li
@budparr
budparr / robots.txt
Last active August 13, 2019 14:21
Jekyll Robots page to exclude from robots pages that are excluded from the sitemap
---
layout: null
permalink: robots.txt
---
# filter pages and documents for the noindex key
{% assign noindexPages = site.pages | where: 'sitemap', false %}
{% assign noindexDocuments = site.documents | where: 'sitemap', false %}
User-agent: *
# robotstxt.org - if _config production variable is false robots will be disallowed.
{% if site.production != true %}
@budparr
budparr / jekyll-amazon-convert-isbn-to-asin.js
Last active April 12, 2016 05:50
Convert a Jekyll site's front matter from a 13 digit ISBN, to a 10 digit ASIN and create a direct link to the book's page on Amazon.
<script type="text/javascript">
function ISBN13toISBN10(isbn13) {var start = isbn13.substring(3, 12);var sum = 0;var mul = 10;var i;for(i = 0; i < 9; i++) {sum = sum + (mul * parseInt(start[i]));mul -= 1;}var checkDig = 11 - (sum % 11);if (checkDig == 10) {checkDig = "X";} else if (checkDig == 11) {checkDig = "0";}return start + checkDig;}document.getElementById("isbn10_{{ isbn }}").innerHTML='<a href="http://www.amazon.com/dp/' + ISBN13toISBN10("{{ isbn }}") +'" title="Amazon" target="_blank" >Amazon</a>';
</script>