Skip to content

Instantly share code, notes, and snippets.

View steventux's full-sized avatar

Steve Laing steventux

View GitHub Profile
@steventux
steventux / devtools setup
Created November 22, 2018 19:47
Quick script to set up vim and git prompt
#!/bin/bash
# Save git-prompt script to home dir
echo "Fetching git prompt script"
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~/.git-prompt.sh
echo "Adding git-prompt to bash"
# Source it and amend bash prompt
cat << 'END' >> ~/.bashrc
@steventux
steventux / git_object_size.sh
Created July 24, 2018 10:50
List the largest git repo objects
#!/bin/bash
git_dir=$1
cd $git_dir && git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest | awk '$2 >= 2^20'
@steventux
steventux / links_by_schema.rb
Created October 11, 2017 15:09
Gets all links property keys for all frontend schemas (from alphagov/govuk-content-schemas).
@steventux
steventux / keybase.md
Created July 21, 2017 14:05
Android created Gist

Keybase proof

I hereby claim:

  • I am steventux on github.
  • I am steventux (https://keybase.io/steventux) on keybase.
  • I have a public key ASD9SOh3M6teaR0nXLNPurnavumlBt-UXt5t7fxVHrfMowo

To claim this, I am signing this object:

@steventux
steventux / technology.json
Last active August 16, 2016 15:34
Service Manual section example
{
"content_id": "c0f55d25-e6f6-4a7b-9142-0be5e07b734e",
"publishing_app": "manuals-publisher",
"rendering_app": "manuals-frontend",
"format": "manual_section",
"locale": "en",
"update_type": "major",
"base_path": "/service-manual/technology",
"public_updated_at": "2016-05-23T12:57:18Z",
"title": "Technology",
@steventux
steventux / manual.json
Last active August 16, 2016 14:48
Common manual schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"child_section_groups"
],
"properties": {
"body": {
"type": "string",
@steventux
steventux / manual_section.json
Last active August 17, 2016 08:57
Common manual section schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"manual"
],
"properties": {
"section_id": {
"type": "string",
Started GET "/foreign-travel-advice/spain" for ::1 at 2016-02-24 16:35:21 +0000
Processing by TravelAdviceController#show as HTML
Parameters: {"country_slug"=>"spain"}
Rendered govuk_component/breadcrumbs (0.7ms)
Rendered govuk_component/title (1.0ms)
Rendered travel_advice/_travel_advice_navigation.html.erb (7.7ms)
Rendered govuk_component/metadata (8.9ms)
Rendered govuk_component/govspeak (0.8ms)
Rendered travel_advice/_country_summary.html.erb (54.9ms)
Rendered govuk_component/related_items (2.0ms)
DraftContentItem.where(publishing_app: "email-campaign-frontend").each do |content_item|
content_item.update_attributes!(publishing_app: "share-sale-publisher")
payload = Presenters::ContentStorePresenter.present(content_item)
ContentStoreWorker.perform_async(
content_store: Adapters::DraftContentStore,
base_path: content_item.base_path,
payload: payload,
)
end
{
"primary_parent":
{
"web_url": "https://www.gov.uk/browse/abroad/travel-abroad",
"title": "Travel abroad",
"parent": {
"web_url": "https://www.gov.uk/browse/abroad",
"title": "Passports, travel and living abroad",
"parent": null
}