Skip to content

Instantly share code, notes, and snippets.

# sort by example
class Counter
def initialize
@count = 0
end
def inc
@count += 1
end
@dwhenry
dwhenry / 2017-08-17-Production-Integration.csv
Created August 18, 2017 10:50
Healthcheck output from Production
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 7.
INFO,Downloaded https://docs.google.com/spreadsheet/pub?key=0AmD7K4ab1dYrdDR5c2tITTNHRUZqajFTTU8wODAzZ1E&single=true&output=csv&gid=1400194374
INFO,Wrote bin/../data//search-results.csv
INFO,Downloaded https://docs.google.com/spreadsheet/pub?key=0AmD7K4ab1dYrdDR5c2tITTNHRUZqajFTTU8wODAzZ1E&single=true&output=csv&gid=9
INFO,Wrote bin/../data//suggestions.csv
+ bundle exec bin/health_check --json=https://www-origin.publishing.service.gov.uk/api/search.json --type=results --auth=betademo:[*******] --rate_limit_token=[*******]
INFO,Connecting to JSON endpoint https://www-origin.publishing.service.gov.uk/api/search.json [auth=yes]
ERROR,Overwriting duplicate check ["dvla contact", "/contact-the-dvla"]
ERROR,Overwriting duplicate check ["travel to brazil", "/foreign-travel-advice/brazil"]
ERROR,Overwriting duplicate check ["ot tax code", "/tax-codes"]
ERROR,Skipping invalid or incomplete row: ,,,,,,,,,,, because: undefined method `split' for nil:NilClass
@dwhenry
dwhenry / 2017-08-17-ES-2.4-Integration.csv
Last active August 18, 2017 10:50
Healthcheck output from Integration running Elasticsearch 2.4
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 7.
INFO,Downloaded https://docs.google.com/spreadsheet/pub?key=0AmD7K4ab1dYrdDR5c2tITTNHRUZqajFTTU8wODAzZ1E&single=true&output=csv&gid=1400194374
INFO,Wrote bin/../data//search-results.csv
INFO,Downloaded https://docs.google.com/spreadsheet/pub?key=0AmD7K4ab1dYrdDR5c2tITTNHRUZqajFTTU8wODAzZ1E&single=true&output=csv&gid=9
INFO,Wrote bin/../data//suggestions.csv
vagrant@development:/var/govuk/rummager$ b bin/health_check -a betademo:nototbeshared
INFO,Connecting to JSON endpoint https://www.gov.uk/api/search.json [auth=yes]
ERROR,Overwriting duplicate check ["dvla contact", "/contact-the-dvla"]
ERROR,Overwriting duplicate check ["travel to brazil", "/foreign-travel-advice/brazil"]
ERROR,Overwriting duplicate check ["ot tax code", "/tax-codes"]
ERROR,Skipping invalid or incomplete row: ,,,,,,,,,,, because: undefined method `split' for nil:NilClass
@dwhenry
dwhenry / test_to_spec.rb
Last active August 15, 2017 23:03
Code to do a simple test to spec conversion
# require 'file'
class TextToSpec
def initialize(path)
@path = path
end
def run
Dir["#{@path}/test/**/*_test.rb"].each do |path|
next if path =~ %r{/support/}
@dwhenry
dwhenry / controller_example.rb
Last active August 29, 2015 14:26 — forked from plcstevens/controller_example.rb
Include this in controllers and render with your JSON to get pagination URLs matching http://jsonapi.org/format/#fetching-pagination specification. Requires that you use https://github.com/amatsuda/kaminari
class ExamplesController < ApplicationController
include Pagination
def index
@examples = Example.order(id: :desc)
render json: { pagination: paginate(@examples), examples: @examples }
end
end
@dwhenry
dwhenry / zsh_hack
Created April 22, 2014 17:31
zsh has to shorten branch name and make command line usage
commit f143e8dd0ffd018b59476dd885a9d922b6ca4dd6
Author: David Henry <dw_henry@yahoo.com.au>
Date: Tue Apr 22 18:30:47 2014 +0100
Hack on the command line for zsh
diff --git a/lib/history.zsh b/lib/history.zsh
index 6559451..04db917 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh