Skip to content

Instantly share code, notes, and snippets.

View BryanSchuetz's full-sized avatar
🎧
"You'll receive the federal funding, you can have a hefty grant".

Bryan Schuetz BryanSchuetz

🎧
"You'll receive the federal funding, you can have a hefty grant".
View GitHub Profile
@BryanSchuetz
BryanSchuetz / eleventy-image-transform.is
Created March 12, 2022 14:19
Responsive image transforms for eleventy
// This file goes in /src/transforms/
// Add this line to .eleventy.js:
// const eleventyImgTransform = require("./src/transforms/eleventy-img-transform.js");
// And add this one to module.exports in .eleventy.js:
// eleventyConfig.addTransform("eleventyImgTransform", eleventyImgTransform);
const Image = require("@11ty/eleventy-img");
const cheerio = require("cheerio");
@BryanSchuetz
BryanSchuetz / .eleventy.js
Created February 24, 2022 12:02
eleventy filter config
const _get = require("lodash.get");
//It seems like, when using these filters on items in a collection with attributes in frontmatter—the keys are mostly on the data object, e.g. `| where('data.key', 'value')`. When using on global data, look for item attributes directly `| where('key', 'value')`
//sort by order attribute
function sortByOrder(values) {
let vals = [...values]; // this *seems* to prevent collection mutation...
return vals.sort((a, b) => Math.sign(a.data.order - b.data.order));
}
//sort collections by title attribute

There are two types of markup in Liquid: Output and Tag.

  • Output markup (which may resolve to text) is surrounded by
{{ matched pairs of curly brackets (ie, braces) }}
  • Tag markup (which cannot resolve to text) is surrounded by
@BryanSchuetz
BryanSchuetz / .bashrc
Created May 7, 2021 16:23
Git branch in bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
NO_COLOR="\[\033[0m\]"
RED="\[\033[0;31m\]"
export PS1="⚑$RED\$(parse_git_branch) $NO_COLOR\w >"
@BryanSchuetz
BryanSchuetz / deploy-site.workflow
Last active December 6, 2018 15:05
A workflow for building your custom Jekyll site, and deploying it back to the gh-pages branch of your repository.
workflow "Deploy Site" {
on = "push"
resolves = ["Build and Deploy Jekyll"]
}
action "Build and Deploy Jekyll" {
uses = "BryanSchuetz/jekyll-deploy-gh-pages@master"
secrets = ["GITHUB_TOKEN"]
}
@BryanSchuetz
BryanSchuetz / images.yml
Created November 21, 2018 17:45
Yaml file for searchable image archive
---
-
image: 01-013
title: sarah williams
keywords: sarah, williams
caption: portrait of sarah williams
-
image: 01-014
title: williams family member
keywords: portrait, williams
@BryanSchuetz
BryanSchuetz / cachebust.rb
Created February 17, 2018 16:19
CSS Cache Bust Jekyll Plugin
module Jekyll
module CacheBust
class CacheDigester
require 'digest/md5'
attr_accessor :file_name, :directory
def initialize(file_name:, directory: nil)
self.file_name = file_name
self.directory = directory
@BryanSchuetz
BryanSchuetz / concat.liquid
Created May 5, 2016 16:20
Concat arrays in Jekyll(liquid)
{% assign all_hosts = "" | split: "" %}
{% for host in site.data.shared_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
{% for host in site.data.paas_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
@BryanSchuetz
BryanSchuetz / filter.json
Last active May 17, 2016 19:38
Game of Thrones Filter Keyword List
{
"IGNORE_LIST": ["#got", "game of thrones", "gameofthrones", "john snow", "tyrion", "arya", "stark", "winterfell", "georgerrmartin", "george martin", "george r. r. martin", "daenerystargaryen", "targaryen", "daenerys", "baratheon", "martell", "lannister", "florent", "tully", "white walkers", "umber", "greyjoy", "whitewalkers", "winter is coming", "winteriscomming", "sansa", "brandon", "rickon", "theon", "asha", "euron", "victarion", "kings landing", "castle black", "cold hands", "westeros", "nights watch", "tyrell", "jorah", "mormont", "samwell", "tarly", "petyr", "baelish", "brienne", "the mountain", "clegane", "davos", "seaworth", "drogo", "khal", "braavos", "asshai", "red priestess", "volantis", "qarth", "valyria", "meereen", "dothrak", "pentos", "astapor", "yunkai", "lys", "sunspear", "lorath", "elyria", "ghis", "iron islands", "the arbor", "redwyne", "pyke", "skagos", "tarth", "dragonstone", "dragon glass", "dragonglass", "myr", "tyrosh", "bolton", "roose"],
}
@BryanSchuetz
BryanSchuetz / adaptive-fixed-width-grid.scss
Created March 18, 2016 15:44
Sass Adaptive Fixed Width Grid
//
// Configuration
//
$font-size: 10px; // Your base font-size in pixels
$column: 48px; // The column-width of your grid in pixels
$gutter: 24px; // The gutter-width of your grid in pixels
//
// Column-widths in variables