Skip to content

Instantly share code, notes, and snippets.

View budparr's full-sized avatar
🎯
Focusing

Bud Parr budparr

🎯
Focusing
View GitHub Profile

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 / csplit.txt
Last active September 28, 2018 08:56
Terminal command to split a list of markdown items into separate documents. Given a "slug" value, the file will be named that. You could also change slug to title and create slugs/filenames from the title. You may also want to run your output through a markdown converter, like https://github.com/domchristie/to-markdown
csplit -k -n 3 export.txt '/^@@@/' {'999'}; for i in xx*; do sed -i '' 's/@@@/---/g' $i; done; for i in xx*; do mv $i `egrep -m1 -e 'slug:.*' $i | sed -e s/[^\]\[A-Za-z0-9~.,_{}\(\)\'\-\+]/-/g -e s/slug--//`.md; done
@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:
@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 / 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-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
{% for link_hash in page.links %}
{% for link in link_hash %}
<a href="{{ link[1] }}">{{ link[0] }}</a>
{% endfor %}
{% endfor %}
@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;
}
@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' %}
{% 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 %}