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
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 / 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": {
@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 / 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="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 / 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 / command-line.md
Last active May 28, 2017
Command line setup for new machine
View command-line.md
  1. Install oh my zsh

  2. Install brew

  3. Install with brew install rbenv

  4. Setup rbenv

  • touch ~/.zshrc
  • open ~/.zshrc
@daviddarnes
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"
<?php
/*
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
?>
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 %}
You can’t perform that action at this time.