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 / dabblet.html
Created May 24, 2012 21:49
To the Batmobile!
<!DOCTYPE html>
<style>
body, html {
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
background: black;
}
@daviddarnes
daviddarnes / Anchor Custom Background Image Field
Last active October 22, 2020 17:30
Custom Image field for Anchor CMS themes.
<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
?>
@daviddarnes
daviddarnes / Anchor Custom Article Field
Created May 26, 2013 10:54
For outputting a custom field marked with 'image' in the database within an article.
<?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
?>
<figure>
@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 / head.html
Last active August 29, 2015 14:08
Anchor Themes head meta
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feeds/rss">
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="generator" content="CMS name">
<!-- Open graph meta -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="Website title">
@daviddarnes
daviddarnes / film-list.md
Last active August 29, 2015 14:10
Films I like but you might too
  • Taken
  • Unknown
  • Bourne Identity (and the rest of Matts)
  • Ronin
  • Old Boy (original)
  • Hostel (fair bit of action for a horror)
  • Eagle Eye
  • The Transporter (the sequels aren't as good)
  • I am Legend
  • Inception
body {
background-color: #333;
color: #B8B8B8;
text-align: center;
}
h2 {
font-weight: 500;
}
@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 / parallax-scrolling.js
Created October 20, 2015 08:48
Parallax scrolling with JavaScript
// Parallax header content
window.onscroll = function emParallax() {
if(window.pageYOffset>1) {
document.getElementById("parallax").style["-webkit-transform"] = "translateY("+(window.pageYOffset/3)+"px)";
} else {
document.getElementById("parallax").style["-webkit-transform"] = "translateY(0px)";
}
}