Skip to content

Instantly share code, notes, and snippets.

@andymantell
andymantell / .editorconfig
Last active July 20, 2022 12:43
my prettier / eslint setup
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
@andymantell
andymantell / gov.js
Last active July 7, 2020 14:41
Gulp task to convert govuk-frontend Nunjucks macros to Jinja2
/**
* NOTE: This script is deprecated and I no longer recommend it's use.
* Within HM Land Registry it is supereceded by https://github.com/LandRegistry/govuk-frontend-jinja
* This repository was born from the outputs of this conversion script, but has had numerous fixes since
* so if you are looking for a stable and accurate jinja implementation of govuk-frontend I would look there first.
*/
const path = require('path')
const fs = require('fs')
const es = require('event-stream')
import React, { useState } from 'react';
import { useFormikContext, useField } from 'formik';
import { DateInput } from 'govuk-react-jsx/govuk';
function DateField(props) {
const { values, errors } = useFormikContext();
const { namePrefix, items, ...restProps } = props;
const [field, meta, helpers] = useField(namePrefix); // eslint-disable-line no-unused-vars
const { setValue, setTouched } = helpers;
@andymantell
andymantell / machine.js
Last active December 12, 2019 15:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@andymantell
andymantell / cloudSettings
Last active October 24, 2019 14:58
VS Code settings
{"lastUpload":"2019-10-24T14:58:38.529Z","extensionVersion":"v3.4.3"}
from jinja2 import PackageLoader, PrefixLoader
...
app.jinja_loader = PrefixLoader({
'app': PackageLoader('name_of_app_folder'),
'govuk_elements_jinja_macros': PackageLoader('govuk_elements_jinja_macros')
})
setuptools.setup(name='govuk-elements-jinja-macros',
version='1.0.7',
description='GOV.UK elements Jinja macros',
packages=['govuk_elements_jinja_macros'],
package_data={'govuk_elements_jinja_macros': ['templates/*.html']}
)
@andymantell
andymantell / deployment.php
Last active April 2, 2016 14:54
Quick and dirty wordpress deployment plugin
<?php
/*
Plugin Name: Deployment routines
Description: Runs update routines allowing code based database updates.
Author: Andy Mantell
Version: 1.0
*/
add_action('admin_init', 'deployment_admin_init');
@andymantell
andymantell / Foo.sublime-project
Last active December 16, 2015 01:09
Per project Sublime Text settings
{
"folders": [
{
"path": "www"
}
],
"settings": {
"rulers": [120],
"tab_size": 2,
"translate_tabs_to_spaces": true,
@andymantell
andymantell / gist:5117319
Created March 8, 2013 15:41
SCSS headings() awesomesauce
#{headings()} {
color: red;
}