Skip to content

Instantly share code, notes, and snippets.

View simonwhatley's full-sized avatar

Simon Whatley simonwhatley

View GitHub Profile
@simonwhatley
simonwhatley / heroku-remote.md
Created May 4, 2022 20:39 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@simonwhatley
simonwhatley / installing-node-with-nvm.md
Created May 24, 2020 09:55 — forked from d2s/installing-node-with-nvm.md
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
@simonwhatley
simonwhatley / filters.js
Created February 27, 2020 14:51 — forked from edwardhorsford/filters.js
Useful Nunjucks filters for the GOV.UK Prototype Kit
/*
=====================================================================
arrayToGovukTable
Convert an array to form needed for govukTable macro
=====================================================================
Expects array or nested array.
Usage:
@simonwhatley
simonwhatley / matches.js
Created January 29, 2020 20:55
11ty filter to filter items in a collection (array) whose key === value. (source: https://paulrobertlloyd.com/)
/**
* Select objects in array whose key matches a value
*
* @param {Array} arr Array to test
* @param {String} key Key to inspect
* @param {String} value Value key needs to match
* @return {String} Filtered array
*
*/
module.exports = function (arr, key, value) {
@simonwhatley
simonwhatley / includes.js
Created January 29, 2020 20:54
11ty filter to filter a collection (array) by key:value pair - used to filter on custom taxonomies other than tags (source: https://paulrobertlloyd.com/)
/**
* Select objects in array whose key includes a value
*
* @param {Array} arr Array to test
* @param {String} key Key to inspect
* @param {String} value Value key needs to include
* @return {String} Filtered array
*
*/
module.exports = function (arr, key, value) {
@simonwhatley
simonwhatley / _markdown.scss
Last active January 20, 2020 11:34
Using govuk-frontend styles in markdown
.app-markdown {
h1 {
@extend %govuk-heading-xl;
}
h2 {
@extend %govuk-heading-l;
}
h3 {

Semantic Version regex

Matches SemVer (Semantic Versioning) strings.

The string may start with a "v" but it is not matched.

/(?<=^[Vv]|^)(?:(?<major>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<minor>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<patch>(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?<prerelease>(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*)))*))?(?:[+](?<build>(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+)))*))?)$/
@simonwhatley
simonwhatley / CODE_OF_CONDUCT.md
Created January 8, 2019 09:57
Contributor Covenant Code of Conduct

Contributor code of conduct

Our pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

Our standards

Examples of behaviour that contributes to creating a positive environment include:

@simonwhatley
simonwhatley / PERFORMANCE_IMPROVEMENT.md
Created January 8, 2019 09:54
Pull Request Template – Requirements for contributing a performance improvement

Requirements for contributing a performance improvement

Description of the change

@simonwhatley
simonwhatley / FEATURE_CHANGE.md
Created January 8, 2019 09:52
Pull Request Template – Requirements for adding, changing or removing a feature

Requirements for adding, changing or removing a feature

  • Fill out the template below. Maintainers are free to close any pull requests that do not include enough information, at their discretion.
  • The pull request must contribute a change that has been endorsed by the maintainer team. See details in the template below.
  • The pull request must update the test suite to exercise the updated functionality.
  • After you create the pull request, all status checks must pass before a maintainer reviews your contribution.

Issue or RFC endorsed by the repository's maintainers