Skip to content

Instantly share code, notes, and snippets.

@fofr
fofr / pages-in-first-test.csv
Created November 9, 2017 17:46
Pages in first test
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
/guidance/introduction-of-statutory-participation-in-trialling-of-national-curriculum-tests-from-2016
/guidance/schools-financial-efficiency-effective-procurement
/government/publications/listening-to-and-involving-children-and-young-people
/guidance/living-in-guatemala
/guidance/design-apprenticeships
/set-up-business
/guidance/notarial-and-documentary-services-guide-for-el-salvador
/guidance/full-time-enrolment-of-14-to-16-year-olds-in-further-education-and-sixth-form-colleges-in-2016-to-2017-academic-year
/guidance/recognised-uk-degrees
/guidance/living-in-cyprus
@fofr
fofr / test_helper.rb
Created September 18, 2017 11:34
test_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
# Rails isn't picking up the RAILS_ENV var
# Without this line env is set to development
Rails.env = ENV['RAILS_ENV']
require 'capybara/rails'
require 'capybara/poltergeist'
require 'slimmer/test'
@fofr
fofr / regression_output.txt
Created September 13, 2017 17:02
Visual regression example output
2017-09-13T16:20:06.816918+00:00 app[web.1]: [2017-09-13 16:20:06] INFO WEBrick 1.3.1
2017-09-13T16:20:06.816953+00:00 app[web.1]: [2017-09-13 16:20:06] INFO ruby 2.3.1 (2016-04-26) [x86_64-linux]
2017-09-13T16:20:06.817359+00:00 app[web.1]: == Sinatra (v2.0.0) has taken the stage on 9089 for production with backup from WEBrick
2017-09-13T16:20:06.817768+00:00 app[web.1]: [2017-09-13 16:20:06] INFO WEBrick::HTTPServer#start: pid=4 port=9089
2017-09-13T16:20:20.609052+00:00 app[web.1]: ---> Running component guide spider on https://government-frontend-pr-459.herokuapp.com
2017-09-13T16:20:20.609070+00:00 app[web.1]: running: wraith spider /app/config/tmp_wraith_spider_component_guide_config.yaml
2017-09-13T16:20:29.527679+00:00 app[web.1]: Config validated. No serious issues found.
2017-09-13T16:20:29.527696+00:00 app[web.1]: Crawling https://government-frontend-pr-459.herokuapp.com/component-guide
2017-09-13T16:20:29.527697+00:00 app[web.1]: /component-guide
2017-09-13T16:20:29.527698+00:00 app[web.1]:
@fofr
fofr / markdown-publisher.md
Last active July 17, 2017 16:33
Markdown publisher

Markdown publisher:

  • A flat file markdown publisher
  • .md files with front-matter and govspeak content
  • Tasks within publisher to send to publishing API
  • Publishing API handles publishing, markdown conversion, etc, does all heavy lifting
  • Edit markdown with PR
  • Deploy re-publishes changed content
  • Lint markdown to confirm valid govspeak
  • Define a rendering app to render content, which will use components and standard mechanisms
@fofr
fofr / attachments_missing_url_to_remove.csv
Created April 11, 2017 13:33
Attachments with missing URLs that are not being used
document_url document_content_id attachment_content_id attachment_title
https://www.gov.uk/cma-cases/energy-price-control-appeal-british-gas-trading 59226dd3-b8a9-4f48-a4fa-dd3e4484900f 52787d3e-edd9-4259-8032-3c19889136f5 Scottish and Southern Energy Power Distribution
https://www.gov.uk/cma-cases/lookers-group-plc-shields-land-rover 3df363a4-67ed-4187-848a-ec7491609d69 e67333d8-f1ef-41cc-b8fd-20285477b962 Lookers.pdf
https://www.gov.uk/cma-cases/midcounties-co-operative-harry-tuffin-investments d4728299-6e7c-4a45-b43a-13fc5343fb59 304b9fb4-24b9-4d50-89f6-a972510b349b midcounties.pdf
@fofr
fofr / attachments_with_missing_urls.csv
Created April 11, 2017 13:32
Attachments with missing URLs
document_url document_content_id attachment_content_id attachment_title attachment_asset_url
https://www.gov.uk/cma-cases/private-motor-insurance-market-investigation 1539d14a-f25f-49a3-ba47-d75053a675fc 7aaa1da9-7d5d-4de8-8915-c492e5d55660 McLaren Autobody response to provisional findings and remedies notice\n (PDF, 88\n Kb) https://assets.publishing.service.gov.uk/media/5329df39e5274a226800032d/140211_mclaren_autobdy_response_to_provisional_findings_and_remedies_notice.pdf
https://www.gov.uk/cma-cases/private-motor-insurance-market-investigation 1539d14a-f25f-49a3-ba47-d75053a675fc 26b8ce1b-f2a0-460b-afea-abd1d1d36cbd Mike Dickinson response to remedies notice (PDF, 14\n Kb) https://assets.publishing.service.gov.uk/media/5329df39e5274a226b000279/140211_mike_dickinson_response_to_remedies_notice.pdf
https://www.gov.uk/cma-cases/private-motor-insurance-market-investigation 1539d14a-f25f-49a3-ba47-d75053a675fc d8ed79ce-a9db-461d-a5f7-374f8474e6ff Response to remedies notice (PDF, 99\n Kb) https://ass
@fofr
fofr / schema_features.md
Last active January 30, 2017 15:20
Features found in "details" and "links" with frequency

Running this script:

task :schema_heuristics do
  usage = {}

  Dir.glob("formats/*/publisher/details.json").each do |filename|
    data = JSON.parse(File.read(filename))
    data["properties"].keys.each do |key|
 if usage[key]
@fofr
fofr / dummy_content_store.js
Created January 16, 2017 13:54
Generate wraith config to test examples in government-frontend
// Run in console on http://govuk-content-store-examples.herokuapp.com/
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
var d = [];
$('tr').each(function() {
var type = $(this).find('td:first-child').text()
var name = $(this).find('td:first-child + td').text().replace('.json', '');
var url = $(this).find('td a').attr('href');
@fofr
fofr / moving-contents-link.js
Created February 23, 2016 19:09
Moving Contents Link module
@fofr
fofr / ratings.csv
Created December 17, 2015 19:42
IMDB Ratings
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
"position","const","created","modified","description","Title","Title type","Directors","You rated","IMDb Rating","Runtime (mins)","Year","Genres","Num. Votes","Release Date (month/day/year)","URL"
"1","tt0708745","Thu Dec 17 00:00:00 2015","","","Star Trek: The Next Generation: Lower Decks","TV Episode","Gabrielle Beaumont","9","8.5","","1987","action, adventure, mystery, sci_fi","1040","1994-02-05","http://www.imdb.com/title/tt0708745/"
"2","tt0708731","Thu Dec 17 00:00:00 2015","","","Star Trek: The Next Generation: Homeward","TV Episode","Alexander Singer","7","7.0","46","1987","action, adventure, mystery, sci_fi","739","1994-01-15","http://www.imdb.com/title/tt0708731/"
"3","tt0708778","Thu Dec 17 00:00:00 2015","","","Star Trek: The Next Generation: Sub Rosa","TV Episode","Jonathan Frakes","5","5.0","46","1987","action, adventure, mystery, sci_fi","873","1994-01-29","http://www.imdb.com/title/tt0708778/"
"4","tt0298203","Sat Dec 12 00:00:00 2015","","","8 Mile","Feature Film","Curtis Hanson","7","7.0","1