Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Making things to help others make things

David Darnes daviddarnes

👨‍💻
Making things to help others make things
Block or report user

Report or block daviddarnes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daviddarnes
daviddarnes / gulpfile.js
Last active Aug 22, 2019
Import your Ghost posts into a Jekyll project using Gulp
View gulpfile.js
const File = require('vinyl');
const gulp = require("gulp");
const Handlebars = require('handlebars');
const streamArray = require('stream-array');
const ghostContentAPI = require("@tryghost/content-api");
const api = new ghostContentAPI({
url: 'https://demo.ghost.io',
key: '22444f78447824223cefc48062',
version: "v2"
@daviddarnes
daviddarnes / index.njk
Created Jun 1, 2019
Eleventy blog from API
View index.njk
<h1>API post list</h1>
<ul>
{% for post in posts %}
<li>
<a href="/posts/{{ post.id }}/">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
View reading-list.md
@daviddarnes
daviddarnes / pluralise.twig
Created Oct 31, 2017
Pluralising with Twig
View pluralise.twig
{% spaceless %}
{% if integer > 1 %}
{{ plural }}
{% else %}
{{ singular }}
{% endif %}
{% endspaceless %}
@daviddarnes
daviddarnes / repeatify.js
Last active Mar 14, 2017
repeatify test
View repeatify.js
function repeatify(count) {
let newString = this;
for (var i = 1; i < count; i++) {
newString += this;
}
return newString;
}
String.prototype.repeatify = repeatify;
@daviddarnes
daviddarnes / file-structure.md
Last active Jun 15, 2016
Jekyll theme file structure
View file-structure.md

root

  • garth-jekyll-theme.gemspec
  • _layouts
    • default.html
    • page.html
    • front.html
    • post.html
  • _includes
    • header.html
    • footer.html
@daviddarnes
daviddarnes / schema-index-new.html
Last active May 19, 2016
Revised Jekyll SEO Tag JSON LD structure
View schema-index-new.html
<!-- Proposed Index json output -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "Dave’s Blog",
"headline": "Dave’s Blog",
"image": "https://www.gravatar.com/avatar/6c0377abcf4da91cdd35dea4554b2a4c?s=600",
"description": "Articles, tutorials and other ramblings",
"publisher": {
View BBC-Recipes-Archive-Proposal.md

Steps to save the BBC Recipes Archive

  1. Setup an organisation on GitHub
  2. Create a repo called "theorgname".github.io
  3. Select a decent default Jekyll template
  4. Use this scraper? https://github.com/forbesg/bbc-good-food-recipe-scraper Or something similar to extract all the recipes (ideally in markdown)
  5. Upload the recipes to the repo, maybe under a new collection type
  6. See what we can do from there?
@daviddarnes
daviddarnes / _config.yml
Last active Apr 7, 2016
Jekyll head meta
View _config.yml
# Permalinks
permalink: pretty
# Posts
excerpt_separator: <!-- more -->
# Site info
url: "https://darn.es"
title: "David Darnes"
description: "Web Designer & Front-end Developer"
You can’t perform that action at this time.