Skip to content

Instantly share code, notes, and snippets.

Avatar

Ed Horsford edwardhorsford

View GitHub Profile
@edwardhorsford
edwardhorsford / filters.js
Last active Feb 27, 2020
Useful Nunjucks filters for the GOV.UK Prototype Kit
View filters.js
/*
=====================================================================
arrayToGovukTable
Convert an array to form needed for govukTable macro
=====================================================================
Expects array or nested array.
Usage:
@edwardhorsford
edwardhorsford / next - previous.njk
Created Sep 7, 2018
Hacky next / previous code
View next - previous.njk
{% set currentProjectIndex = 0 %}
{% set countOfProjects = collections.design.length %}
{% for project in collections.design %}
{% if project.url == page.url %}
{% set currentProjectIndex = loop.index0 %}
{% endif %}
{% endfor %}
{% set previousProjectIndex = currentProjectIndex - 1 %}
View UK Phone number variation
[
'07700900456', // mobile
'+447700900456',
'(+44) 07700900456',
'07700 900 456',
'07700 900456',
'+447700 900456',
'01144960573', // sheffield (4 digit area)
'+441144960573',
'+44114 4960573',
@edwardhorsford
edwardhorsford / GOV.UK service back links
Last active Aug 29, 2015
HTML and CSS for GOV.UK back links.
View GOV.UK service back links
@edwardhorsford
edwardhorsford / govuk_service_email_template
Last active Apr 19, 2016
GOV.UK service email template
View govuk_service_email_template
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<!-- This disables auto detection of phone numbers in some clients. Remove if not needed. -->
<meta name="format-detection" content="telephone=no">
<title>Page title</title>
</head>
<body style="font-family: Helvetica, Arial, sans-serif;font-size: 16px;margin: 0;color:#0b0c0c">
@edwardhorsford
edwardhorsford / guide-template.html
Last active Aug 29, 2015
The basics needed to fake a 'GOV.UK guide' in the express prototype. Hacky
View guide-template.html
{{<layout}}
{{$pageTitle}}Index{{/pageTitle}}
{{$content}}
<main id="content" role="main" class="group multi-page">
<header class="page-header group">
<div>
<h1>{{guideTitle}}</h1>
</div>