Skip to content

Instantly share code, notes, and snippets.

View gazjoy's full-sized avatar
🦆

Gareth Joyce gazjoy

🦆
View GitHub Profile
@ccstone
ccstone / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Last active May 10, 2024 15:41
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@robpataki
robpataki / .profile
Last active August 2, 2018 10:30
Bash profile
export PATH="/usr/local/bin:usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/etc:/usr/local/mysql/bin:/.rbenv/bin:$PATH"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home"
# Load SSH keys
ssh-add -K ~/.ssh/id_rsa
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@daveredfern
daveredfern / Default gulp file
Last active August 29, 2015 14:23
An example gulp file to compile sass, jshint javascript and optimise images
/*!
* gulp
* $npm init
* $ npm install gulp-sass gulp-autoprefixer gulp-minify-css gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache gulp-sourcemaps del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
@atelierbram
atelierbram / set-active-class-in-nunjucks.md
Last active February 26, 2022 05:37
Set Active Class on Nav-Menu-Item in Nunjucks

In html/about/index.html:

{% extends "layouts/layout.njk" %}

{% set base_path = "../../" %}
{% set page_title = "about" %} 

In data.json:

Accessibility criteria for Modal Dialog - WIP

User story

As an Assistive Technology (AT) user, I want to be informed that a modal dialog has opened, what its purpose is, and how to action / close it.

Acceptance criteria

The modal dialog must:

@joelanman
joelanman / routes.js
Last active June 29, 2018 09:42
how to use marked
const express = require('express')
const router = express.Router()
const marked = require('marked')
// Route index page
router.get('/', function (req, res) {
res.render('index')
})
// Add your routes here - above the module.exports line
@robpataki
robpataki / how-we-do-git.md
Last active May 30, 2022 15:16
This is how we do git (rebase, feature branches, PRs)

How to / Git

Branching strategy

We use a form of Git flow to maintain a stable master branch, and work off feature branches to introduce new features and other code updates. The feature branches are tied to JIRA tickets.

To keep our git log clean and tidy we use git's rebase strategy. That means that instead of merging commits in and out of the master branch (resulting in many ugly merge commits) we always keep our own feature branch's commits on top of the existing master branch commits.

You can read more about the rebase strategy here: https://www.atlassian.com/git/tutorials/merging-vs-rebasing.

@robpataki
robpataki / time-travel.js
Created September 19, 2018 12:35
Display moment style dates in the front-end
/*
Example usage:
<span class="moment" data-moment="add 12 days"></span>
*/
'use strict'
import moment from 'moment'
/* TimeTravel */
@robpataki
robpataki / nunjucks-snippets.njk
Created November 15, 2018 14:27
Nunjucks snippets
{# Conditionally render inline CSS class #}
<div class="govuk-grid-row {{ 'govuk-!-margin-top-9' if not(showBackButton) else 'govuk-!-margin-top-3' }}">
router.get("/letters-contact-preference-audio", function(request, response){
let preferences = request.session.data['lettersContactPreference']
if (preferences.length && preferences.includes('audio'){
response.render("letters-contact-preference-audio")
} else {
response.redirect("/letters-contact-preference-braille")
}