Skip to content

Instantly share code, notes, and snippets.

View jamesdoc's full-sized avatar
🐢
Sitting at the intersection of Christianity and technology…

James Doc jamesdoc

🐢
Sitting at the intersection of Christianity and technology…
View GitHub Profile
require("dotenv").config();
const { AssetCache } = require("@11ty/eleventy-cache-assets");
const Airtable = require("airtable");
// You configure here…
const airtableBaseId = "{{ GET ME FROM AIRTABLE }}";
const airtableTable = "{{ NAME OF YOUR TABLE }}";
const airtableTableView = "{{ THE VIEW YOU WANT TO PULL FROM }}";
const assetCacheId = "airtableCMS";
@jamesdoc
jamesdoc / 11ty-markdown-rwd-config.js
Created December 25, 2018 19:13
markdownItResponsive config for 11ty
const options = {
html: true,
breaks: true,
linkify: true,
};
const rwdOptions = {
responsive: {
'srcset': {
'*': [ {
@jamesdoc
jamesdoc / 11ty-filename-filter.js
Last active December 25, 2018 19:05
Filter for 11ty to add a suffix to a filename
eleventyConfig.addFilter("imgSuffix", (imgStr, suffix)=> {
const i = imgStr.lastIndexOf('.');
const imgPath = imgStr.substring(0, i);
const ext = imgStr.substring(i + 1);
return `${imgPath}-${suffix}.${ext}`;
});
@jamesdoc
jamesdoc / blog-to-markdown.py
Created September 1, 2018 12:12
Export old MySQL post table to MarkDown files
import json
import os
with open('oldblog.json') as f:
data = json.load(f)
sorted_pages = sorted(data, key=lambda k: int(k['id']))
posts = (x for x in sorted_pages if x['page_status'] in 'published')
for post in posts:
@jamesdoc
jamesdoc / index.html
Last active August 29, 2015 14:05
VAM Shop Widget
<html>
<head>
<title>Shop Scraper</title>
<link rel="stylesheet" type="text/css" href="http://www.vam.ac.uk/_designs/new-squiz/css/main.css" media="all" />
<style>
.shop_widget a{
background-size: cover;
background-repeat: no-repeat;