Skip to content

Instantly share code, notes, and snippets.

View daviddarnes's full-sized avatar
🧱
he/him

David Darnes daviddarnes

🧱
he/him
View GitHub Profile
@daviddarnes
daviddarnes / app.js
Created January 9, 2020 09:06
Mini Node server for triggering 11ty builds
const http = require('http');
const process = require('process');
const { exec } = require('child_process');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
console.log('Ghost content updated!');
process.chdir('../eleventy/');
@daviddarnes
daviddarnes / index.njk
Created June 1, 2019 08:02
Eleventy blog from API
<h1>API post list</h1>
<ul>
{% for post in posts %}
<li>
<a href="/posts/{{ post.id }}/">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
@daviddarnes
daviddarnes / reading-list.md
Last active April 13, 2018 11:42
To read list
@daviddarnes
daviddarnes / command-line.md
Last active May 28, 2017 19:35
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
daviddarnes / repeatify.js
Last active March 14, 2017 11:57
repeatify test
function repeatify(count) {
let newString = this;
for (var i = 1; i < count; i++) {
newString += this;
}
return newString;
}
String.prototype.repeatify = repeatify;
@daviddarnes
daviddarnes / Anchor CMS Open Graph Meta
Last active January 19, 2017 23:16
Open Graph meta information for Facebook and Google+
<!-- 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="http://websiteaddress.com">
<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 "http://websiteaddress.com/" . current_url(); ?>">
<meta property="og:title" content="<?php echo page_title('Page can’t be found'); ?> - <?php echo site_name(); ?>">
@daviddarnes
daviddarnes / file-structure.md
Last active June 15, 2016 09:05
Jekyll theme file structure

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 08:14
Revised Jekyll SEO Tag JSON LD structure
<!-- 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": {
@daviddarnes
daviddarnes / BBC-Recipes-Archive-Proposal.md
Created May 17, 2016 11:16
BBC Recipes Archive Proposal

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?