Skip to content

Instantly share code, notes, and snippets.

View peteryates's full-sized avatar
🪶

Peter Yates peteryates

🪶
View GitHub Profile
@peteryates
peteryates / fixing-tables.patch
Created June 24, 2024 10:40
Fixing a pandoc-generated Word table in AsciiDoc
diff --git a/documentation/providers/ecf-call-off-contract-2023-2024-redacted.adoc b/documentation/providers/ecf-call-off-contract-2023-2024-redacted.adoc
index c0dbeff..ca2fe44 100644
--- a/documentation/providers/ecf-call-off-contract-2023-2024-redacted.adoc
+++ b/documentation/providers/ecf-call-off-contract-2023-2024-redacted.adoc
@@ -3393,9 +3393,9 @@ of the KPI target
[width="100%",cols="57%,27%,16%",options="header",]
|===
-|*KPI;* |*Measure* |
-a|
erDiagram
    User ||--o{ Application : makes
    Application ||--o{ Course : "for a"
    Application ||--o{ "Lead Provider" : "provides"
    School o|--o{ "Application" : ""
    "Private childcare provider" o|--o{ Application : ""
    Cohort ||--o{ Application : ""
    Cohort ||--o{ Statement : ""
 Cohort ||--o{ Schedule : "belongs to" 
@peteryates
peteryates / notify-api.md
Created April 13, 2023 11:01
Making requests to the Notify API via the command line

Accessing the Notify API from the command line

Prerequisites

Building a bearer token

  1. First generate an API key using Notify's admin interface. The API key consists of three parts:
@peteryates
peteryates / suggestion.patch
Created November 26, 2021 16:58
suggested simplification
diff --git a/lib/govuk_design_system_formbuilder/elements/date.rb b/lib/govuk_design_system_formbuilder/elements/date.rb
index 84430d1..b11bc4e 100644
--- a/lib/govuk_design_system_formbuilder/elements/date.rb
+++ b/lib/govuk_design_system_formbuilder/elements/date.rb
@@ -56,33 +56,21 @@ module GOVUKDesignSystemFormBuilder
def day
return if omit_day?
- if maxlength_enabled?
- date_part(:day, width: 2, link_errors: true, maxlength: 2)
@peteryates
peteryates / userContent.css
Created August 21, 2020 11:11
Make the docs wider
@-moz-document domain(design-system.service.gov.uk) {
.app-width-container {
max-width: 95% !important;
}
pre > code {
font-size: 12px !important;
}
}
@peteryates
peteryates / 0_wtf.md
Last active June 4, 2024 13:45
Calling Nunjucks from Ruby

Ever wanted to render nunjucks macros from Ruby? Neither have I, until half an hour ago.

Here's a quick approach using the excellent Schmooze from Shopify.

Screenshot from 2020-08-01 16-28-12

Try it yourself

Save nunjucks.rb in a new directory then:

Keybase proof

I hereby claim:

  • I am peteryates on github.
  • I am graphia (https://keybase.io/graphia) on keybase.
  • I have a public key ASBGOYvkY6lza046FbiAHWGsWDt_KhXRM0UPwvqLsEVUCQo

To claim this, I am signing this object:

@peteryates
peteryates / _form.html.erb
Last active November 7, 2019 15:35
Form with acceptance validation
<%= form_with(model: account, local: true) do |form| %>
<%= form.govuk_error_summary %>
<%= form.govuk_email_field(:email) %>
<%= form.govuk_check_boxes_fieldset :terms_and_conditions,
legend: { text: 'Please accept our terms and conditions' } do %>
<%= form.hidden_field :terms_and_conditions, value: false %>
<%= form.govuk_check_box :terms_and_conditions, true, multiple: false, link_errors: true %>
@peteryates
peteryates / govuk-ruby-lint.vim
Created September 24, 2019 12:47
A twist on the Rubocop linter customised to work with govuk-ruby-lint
" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
" Description: RuboCop, a code style analyzer for Ruby files
call ale#Set('ruby_rubocop_executable', 'govuk-lint-ruby')
call ale#Set('ruby_rubocop_options', '')
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
return ale#ruby#EscapeExecutable(l:executable, 'govuk-lint-ruby')
@peteryates
peteryates / common_steps.rb
Last active February 8, 2019 10:05
Interacting with checkboxes and radio buttons
Given("I am on the {string} page") do |string|
path_for(string).tap do |p|
visit(p)
expect(page.current_path).to eql(p)
end
make_inputs_opaque if opaquify_inputs?
end