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 / index.njk
Created Jun 1, 2019
Eleventy blog from API
View index.njk
<h1>API post list</h1>
{% for post in posts %}
<a href="/posts/{{ }}/">{{ post.title }}</a>
{% endfor %}
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: '',
key: '22444f78447824223cefc48062',
version: "v2"
daviddarnes / pluralise.twig
Created Oct 31, 2017
Pluralising with Twig
View pluralise.twig
{% spaceless %}
{% if integer > 1 %}
{{ plural }}
{% else %}
{{ singular }}
{% endif %}
{% endspaceless %}
daviddarnes / Anchor Custom Background Image Field
Last active Mar 2, 2018
Custom Image field for Anchor CMS themes.
View Anchor Custom Background Image Field
<div class="bg-header"
This is to show a custom field from an article.
It will need to be created in the metadata section before it can be used in the post edit area.
In this case the custom field will need to be called 'image' and be set as an image custom field in the dropdown for type.
$image = article_custom_field('image'); // Applying a variable to the custom field, so it can be reused with ease
if ( !empty($image) ) : // Check if the field is empty, if it is the process stops here
daviddarnes /
Last active May 28, 2017
Command line setup for new machine
  1. Install oh my zsh

  2. Install brew

  3. Install with brew install rbenv

  4. Setup rbenv

  • touch ~/.zshrc
  • open ~/.zshrc
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 / Anchor CMS Open Graph Meta
Last active Jan 19, 2017
Open Graph meta information for Facebook and Google+
View Anchor CMS Open Graph Meta
<!-- Open graph meta -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="<?php echo site_name(); ?>">
<?php if(is_homepage() == true) : ?>
<meta property="og:url" content="">
<meta property="og:title" content="<?php echo site_name(); ?>">
<meta property="og:description" content="<?php echo site_description(); ?>">
<?php else: ?>
<meta property="og:url" content="<?php echo "" . current_url(); ?>">
<meta property="og:title" content="<?php echo page_title('Page can’t be found'); ?> - <?php echo site_name(); ?>">
daviddarnes /
Last active Jun 15, 2016
Jekyll theme file structure


  • garth-jekyll-theme.gemspec
  • _layouts
    • default.html
    • page.html
    • front.html
    • post.html
  • _includes
    • header.html
    • footer.html
You can’t perform that action at this time.