Skip to content

Instantly share code, notes, and snippets.

View zachleat's full-sized avatar
🚨
GitHub Drop ICE

Zach Leatherman zachleat

🚨
GitHub Drop ICE
View GitHub Profile
@zachleat
zachleat / gist:f100f71a8ad2bad57d65511290717f1c
Created September 7, 2020 21:42
Eleventy Benchmark September 7, 2020 (Eleventy 1.0 Alpha Build)
---------------------------------------------------------
Eleventy Benchmark (Node v14.9.0, 1000 templates each)
---------------------------------------------------------
Eleventy 0.10.0
---------------------------------------------------------
liquid: ... 3 runs
* Median: 1.02 seconds
* Median per template: 1 ms
njk: ... 3 runs
@zachleat
zachleat / queuecode.js
Last active March 7, 2021 02:21
Queue Code Starter Gist
/*
Queue Code
https://queuecode.zachleat.dev/
Usage:
- Press any key to reveal the next character of source code. Use delete to hide characters.
- Use the `url` query param to point to a different source code file.
e.g. https://queuecode.zachleat.dev/?url=https://gist.githubusercontent.com/zachleat/a7393810acf7890e6bef6a34eaa7b78c/raw/smoothscroll.css
@zachleat
zachleat / index.html
Created March 6, 2021 23:17
HTML Boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<title></title>
</head>
<body>
@zachleat
zachleat / reading_time.rb
Last active October 21, 2020 23:00
Read this in X minutes Liquid Filter Plugin (for Jekyll)
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@zachleat
zachleat / gist:dd68700493492517ae718c2f148debc2
Created September 11, 2020 23:03
Pretend PHP in Eleventy with Nunjucks
// .eleventy.js
let Nunjucks = require("nunjucks");
module.exports = function(eleventyConfig) {
let env = Nunjucks.configure(".", {
tags: {
blockStart: '<?php',
blockEnd: '?>',
}
});
html {
scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
}
@zachleat
zachleat / gist:8cd9f1844c7144099c54533fff1b0a76
Created April 18, 2020 04:17
Eleventy Vue Responsive Images Plugin Sample Input/Output
<responsive-image
path="./src/images/home-store.jpg"
alt="The front entrance to a store"
:widths="[350, null]" />
<!-- BECOMES -->
<picture>
<source srcset="/v3/img/respimg/ef7c5bc4-350.webp 350w, /v3/img/respimg/ef7c5bc4.webp 589w" type="image/webp">
<source srcset="/v3/img/respimg/ef7c5bc4-350.jpeg 350w, /v3/img/respimg/ef7c5bc4.jpeg 589w" type="image/jpeg">
@zachleat
zachleat / .eleventy.js
Last active March 21, 2020 02:11
Eleventy + Vue Preview
const eleventyVue = require("@11ty/eleventy-plugin-vue");
module.exports = function(eleventyConfig) {
// Use Defaults
eleventyConfig.addPlugin(eleventyVue);
// OR, Use your own options
eleventyConfig.addPlugin(eleventyVue, {
// Directory for single file components (defaults to includes folder)
componentsDirectory: "",
@zachleat
zachleat / gist:96516e8a3bbff53355ba65f0b7732aed
Last active February 17, 2020 05:59
Installing phantomjs 2.5.0 Beta
# First download phantomjs-2.5.0-beta-macos.zip from https://bitbucket.org/ariya/phantomjs/downloads
# I put mine into ~/Code/phantomjs-2.5.0-beta-macos
~/Code/phantomjs-2.5.0-beta-macos/bin ᐅ ./phantomjs
dyld: Library not loaded: /usr/local/opt/webp/lib/libwebp.6.dylib
Referenced from: /Users/zachleat/Code/phantomjs-2.5.0-beta-macos/bin/./phantomjs
Reason: image not found
[1] 33803 abort ./phantomjs
~/Code/phantomjs-2.5.0-beta-macos/bin ᐅ brew install webp
@zachleat
zachleat / gist:980895
Created May 19, 2011 14:41
HTML5 Boilerplate Issue #378 (No Compatibility View button, tested in IE7/IE8/IE9)
<!--[if IE ]><![endif]-->
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">