Skip to content

Instantly share code, notes, and snippets.

Moving slowly and fixing things

Paul Robert Lloyd paulrobertlloyd

Moving slowly and fixing things
View GitHub Profile
paulrobertlloyd /
Last active Mar 25, 2020
Different result via npm script and npx

If I use the following npm script:

"scripts": {
  "lint:markdown": "markdownlint app/**/*.md",

and run npm run lint:markdown, the glob only finds 5 files.

paulrobertlloyd / routes.js
Last active Oct 1, 2019
Express application routes - Authentication using IndieAuth
View routes.js
// Express
const express = require('express');
const router = new express.Router();
// IndieAuth
const IndieAuth = require('indieauth-helper');
const auth = new IndieAuth({
secret: 'topSecretString'
View diff.html
<!doctype html>
<html lang="en-gb" prefix="og:">
<meta charset="utf-8">
<meta property="og:title" content="404">
<meta property="og:description" name="description" content="There’s nothing useful here. Sorry about that.">
<meta property="og:url" content="/404">
<meta property="og:image" content="/images/app.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@paulrobertlloyd">
paulrobertlloyd / 1-defaultConfig.js
Last active Mar 2, 2019
Merging two object arrays?
View 1-defaultConfig.js
'post-types': [{
type: 'article',
name: 'Article',
path: {
template: 'app/templates/article.njk',
post: '_posts/{{ published }}-{{ slug }}.md',
file: 'images/{{ published }}/{{ slug }}/{{ filename }}',
url: '{{ published }}/{{ slug }}'
}, {
paulrobertlloyd / index.html
Created May 9, 2018
Andy Dennis’ function introduction
View index.html
<a class="that" href="yippee.html">That link</a>
var foo = function () {
var $ = document.querySelector.bind(document)
var el = {
thatLink: $('a.that')
function addListeners () {
paulrobertlloyd / context.json
Last active Aug 3, 2019
Looping over values with Nunjucks. Some values are strings, some values are arrays. Now what?
View context.json
"items": [
"name": "Last modified time",
"value": "2004-12-23T23:33Z"
"name": "Recommended update interval",
"value": "60s"
paulrobertlloyd / Directory structure
Created May 8, 2015
[gulp-sass] no mixin named red
View Directory structure
# src/base/scss/
- base.scss
- helpers/
- mixins.scss
- variables.scss
# src/components/button/
- button.scss
paulrobertlloyd / figure.html
Created Jan 9, 2015
Custom Liquid tag block to render a figure with optional caption
View figure.html
<!-- Arguments without quotes -->
<!-- ISSUE: Only content between first two quotes rendered -->
<figure class="figure class1"><div class="figure__main">
<p><img src="/assets/images/2008/12/chicago.jpg" alt="" /></p>
</div><figcaption class="figure__caption"><p>Cloud&nbsp;Gate</p>
<!-- Arguments with single quotes, regardless of content -->
<!-- ISSUE: Nothing generated if argument contains quotes -->
<figure class="figure class1 class2"><div class="figure__main">
paulrobertlloyd / Rakefile
Last active Aug 29, 2015
Iterate though matched patterns in document, perform a function on each match, and write result to file
View Rakefile
desc "Replace email addresses in remarks with md5 hashed strings"
task :hash do |t|'source/_data/remarks/*.yml').each do |path|, 'r+:utf-8') do |file_name|
require 'digest/md5'
private :hash
def hash(email)
email_address = email ? email.downcase.strip : ''
paulrobertlloyd / Rakefile
Last active Aug 29, 2015
Rake task to concatenate CSS files
View Rakefile
destination = 'public'
source = 'source'
desc "Concatenate CSS files"
task :concatenate_css do
files = FileList["#{source}/**/*.css"]
concatenated_filename = "#{destination}/stylesheets/styles.css", "w") do |output|
files.each do |input|