Skip to content

Instantly share code, notes, and snippets.

View wheresrhys's full-sized avatar

Rhys Evans wheresrhys

View GitHub Profile
@wheresrhys
wheresrhys / script.js
Last active January 3, 2023 16:12
Update team membership
import {BizOpsClient} from '@financial-times/biz-ops-client';
const client = new BizOpsClient({
apiKey: process.env.BIZ_OPS_API_KEY,
userID: "rhys.evans",
host: "https://api-t.ft.com/biz-ops"
})
const {teams} = await client.graphQL.get(`{teams {
code
@wheresrhys
wheresrhys / longestIncreasingSequence
Last active October 15, 2021 16:46
Javascript function for finding the longest increasing subsequence within a sequence of numbers (stored as an array) . Also included is a derivative function which finds the longest decreasing sequence.
//
// longestIncreasingSequence
// ---
//
// Javascript function for finding the longest increasing subsequence within a sequence of numbers
//
// @param {Array} arr The array containng the sequence
// @param {Boolean} strict Boolean specifying whether to use strict (`<`) inequality (default is to use `<=`)
// @return {Array}
//
@wheresrhys
wheresrhys / output.sh
Created December 18, 2020 10:30
JSON schema test
/*** Validating ***/
{ a: 'some' }
strict mode: missing type "string" for keyword "pattern" at "#/if/properties/a" (strictTypes)
/*** Validating ***/
{ b: 'other' }
ValidationError: validation failed
at validate (/Users/rhys.evans/Projects/or/treecreeper/packages/tc-schema-validator/validation/ajv-test.js:28:15)
at Object.<anonymous> (/Users/rhys.evans/Projects/or/treecreeper/packages/tc-schema-validator/validation/ajv-test.js:33:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
@wheresrhys
wheresrhys / 1. Overview.md
Last active October 19, 2020 10:36
Upgrading circleci pipelines to authenticate with docker

On 1st November dockerhub (and underlying platform used by circleci) will be imposing rate-limits on all unauthenticated requests.

In order to avoid this making it impossible for us to build any of our projecs, we need to add authentication to every circleci config.

Below is an outline of how to apply these changes to a typical config file

// Allow package.json scripts property to be defined in a separate .npmscripts.js file
// (Prior art all the *rc files for various other tools - once there is need for, comments, multiline
// dependencies, logic... it pays to support .js as well as .json
// can require any libraries you like
require('dotenv').exec();
module.exports = {
// strings are run with shell
test: "jest",
@wheresrhys
wheresrhys / maxi.md
Last active March 11, 2020 22:11
PR comment

It looks like you've made significant changes to this repository's source code. Have you given enough thought to reliability?

If you've added/removed a dependency on another service...

  • Have you updated the dependencies list in the runbook?
  • Have you got healthchecks that probe the health of each dependency?
  • Have you added integration tests that cover scenarios where the dependency is down?

If you've changed the architecture...

@wheresrhys
wheresrhys / gist:5822860
Last active November 15, 2019 14:51
Vertical and horizontally centered overlay using just css (flexbox)
.overlay-mask {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-flex-align: center;
-ms-flex-align: center;
[...document.querySelectorAll('.State:not([title="Status: Open"])')].map(e=>e.closest('.js-branch-row').querySelector('.js-branch-delete-target').click())
@wheresrhys
wheresrhys / strawman.md
Last active January 18, 2019 15:46
Runbooks in repos

Runbooks in repos straw man proposal

open questions

  • discovery of repos that contain docs - how. pull or push model
  • default docs folder name & structure. Coexistence with other docs?
  • discourage linking to people & teams? (Too hard to bulk change?)
  • how to avoid having to list refs to each .md file
  • how to put properties related to a md file with the content e.g. failOverInfo = free text field => md file failOverType = enum => ... front matter in md file?
@wheresrhys
wheresrhys / communique.md
Created October 26, 2018 12:54
Dewey is end of life

TLDR;

Dewey is on its way out, to be replaced by https://biz-ops.in.ft.com. It's new, and by implication, imperfect. Please use it and let us know what you think.

Why replace Dewey?

FT's technical estate and its relationship to other aspects of the business are a complex web. Dewey's data layer was inadequate to the task of modelling this, so a decision was made to try rebuilding on top of a graph database. A few months later, and with a number of key dependencies (e.g. AWS cost allocation) already migrated from Dewey to the new Biz-Ops (Business Operations) data layer, it's time to migrate the administration of the data to a UI that talks directly to the new data layer, rather than via the imperfect proxy of an event log coming from Dewey.

What's different about Biz-Ops?

As touched on above, the major difference is that the underlying data structure is a graph. This means for example that where previously Cost Centre was a direct property on systems, now finding which Cost Centre to bill a system