Skip to content

Instantly share code, notes, and snippets.

@alextea
alextea / accessible-autocomplete-prototype-kit.md
Last active December 7, 2022 17:03
This is a step by step guide on how to use the accessible autocomplete component in the GOV.UK prototype kit

Using accessible autocomplete in the GOV.UK prototype kit

This is a step by step guide on how to use the accessible autocomplete component in the GOV.UK prototype kit. There aren’t any instructions included with the code for using with the prototype kit, and it’s not straightforward if you’re not familiar with javascript.

I have an example repo you can download to check the code.

Download

Download the accessible autocomplete code, you can download the zip or clone the repo if you prefer to use git.

Copy the files to your prototype

Copy the minified files from the /dist folder to your prototype.

@alextea
alextea / application.js
Created August 11, 2021 16:12
Extend alphagov/accessible-autocomplete to use select values as synonyms
$(document).ready(function () {
window.GOVUKFrontend.initAll()
let selectElement = document.querySelector('#my-category-select')
accessibleAutocomplete.enhanceSelectElement({
defaultValue: '',
source: (query, populateResults) => {
const options = selectElement.querySelectorAll('option')
let results = []
@alextea
alextea / c64.md
Last active August 22, 2018 15:20
Commodore 64 with games & accessories for sale

Commodore 64

Hardware:

  • Commodore 64
  • Power supply
  • Datasette Tape Deck
  • Atari joystick controller

Games:

@alextea
alextea / .bash_profile
Last active June 12, 2018 13:14
My bash profile with minimal prompt
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:~/.local/bin:$PATH"
source ~/.git-completion.bash
# Get the name of the branch we are on
git_prompt_info() {
branch_prompt=$(__git_ps1)
if [ -n "$branch_prompt" ]; then
echo $branch_prompt
@alextea
alextea / crests.txt
Created June 5, 2018 14:46
Organisations using images where we should be using the single identity logo
RPA
https://www.gov.uk/government/organisations/rural-payments-agency
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/58/RPA_582_SML_AW-_12mm-crest___Ex_.jpg
APHA
https://www.gov.uk/government/organisations/animal-and-plant-health-agency
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/1079/A_PHA_582_AW.png
UK Hydrographic Office
https://www.gov.uk/government/organisations/uk-hydrographic-office
<div class="grid-row">
<div class="available-languages">
<ul>
<li class="translation">
<span>English</span>
</li>
<li class="translation last">
<a lang="cy" hreflang="cy" href="/dechrau">Cymraeg</a>
</li>
</ul>
@alextea
alextea / rgb_test.py
Created December 3, 2016 16:08
Cycle through R, G and B on a single neopixel
# NeoPixel library strandtest example
# Author: Tony DiCola ([email protected])
#
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from neopixel import *
# LED strip configuration:
LED_COUNT = 50 # Number of LED pixels.
@alextea
alextea / gist:12ecab18cc3ebebb86fe7064e4801fa1
Last active April 6, 2016 13:47
Regular expressions for converting mustache to nunjucks
# template tag
\{\{<([^}]+)\}\}
{% extends "$1.html" %}
# includes tag
\{\{>([^}]+)\}\}
{% include "$1.html" %}
# block tag
\{\{\$([^}]+)\}\}
@alextea
alextea / top-records-2015.md
Last active December 11, 2015 15:37
Top records & reissues 2015
@alextea
alextea / highlightcells.js
Created June 25, 2015 16:49
Function to extract numeric data from mixed content cells and apply a heatmap to them in Google Sheets
function highlightcells() {
var sheet = SpreadsheetApp.getActiveSheet();
var allData = sheet.getDataRange();
var dataRange = sheet.getRange(2,3,allData.getLastRow(),allData.getLastColumn());
var data = dataRange.getValues();
// iterate over data
var values = [];
for (var i = 0; i < data.length; i++) {