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 / 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 / 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>
@budparr
budparr / Jekyll-pages-organized-in-folder
Created April 17, 2016 13:00
How to make Jekyll Pages more organized
Add this to your config.yml file:
```
include:
- _pages
```
and then, if you want the filename to be your permalink (without the _pages in the url), do this: in config.yml, add this to your defaults:
```
- scope:
path: '_pages'
values:

Keybase proof

I hereby claim:

  • I am budparr on github.
  • I am budparr (https://keybase.io/budparr) on keybase.
  • I have a public key whose fingerprint is 9DDE D468 81E7 3D62 C315 1F12 FFD4 EFBD AF91 5796

To claim this, I am signing this object:

@budparr
budparr / jekyll-events.html
Last active July 25, 2016 01:49
Jekyll Events, with limiting posts
{% assign events = "" | split: "|" %}
{% for item in site.posts %}
{% assign current_date = site.time | date: "%Y%m%d" %}
{% assign postdate = item.date | date: "%Y%m%d" %}
{% if postdate > current_date %}
{% assign events = events | push: item %}
{% endif %}
{% endfor %}
@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 / test.html
Created November 10, 2016 17:36
Sample code for Jekyll Workshop
<!-- code -->
@budparr
budparr / widow-control.js
Created November 17, 2016 20:47
widow control script
//control widows, ala www.css-tricks.com/preventing-widows-in-post-titles/
$("ID").each(function() {
var wordArray = $(this).text().split(" ");
if (wordArray.length > 1) {
wordArray[wordArray.length-2] += "&nbsp;" + wordArray[wordArray.length-1];
wordArray.pop();
$(this).html(wordArray.join(" "));
}
});
.Site.Pages = All the Pages (note the capital P) in the site.
.Data.Pages: All the Pages for the given Node (sections, taxonomies). This will be a subset of the above for all other nodes than the home page: On that Node I believe these slices are the same.
@budparr
budparr / hugo-repeater.html
Created January 12, 2017 03:12
Hugo repeater using modulo
{{ define "main" }}
{{ $.Scratch.Add "boxClasses" "dt flex center pt0 pb3 pv3-m pv3-ns" }}
{{ $.Scratch.Add "boxCopyClasses" "db dtc-ns v-mid w-100 w-75-ns" }}
{{ $.Scratch.Add "boxImageClasses" "db dtc-ns v-mid-ns w-25" }}
{{ $.Scratch.Add "ImageClasses" "w-100" }}
<main class="cf pa3 pa4-m pa5-l mw9 w-60-l center">
<h2>
{{ .Title }}
</h2>