Skip to content

Instantly share code, notes, and snippets.

View triblondon's full-sized avatar

Andrew Betts triblondon

View GitHub Profile

Keybase proof

I hereby claim:

  • I am triblondon on github.
  • I am triblondon (https://keybase.io/triblondon) on keybase.
  • I have a public key whose fingerprint is 7B4B 0965 A224 FC49 0EB1 9D77 70F9 96E8 4701 AE13

To claim this, I am signing this object:

@triblondon
triblondon / http-structured-headers.peg
Last active December 3, 2018 19:13
PEG parser for HTTP Structured headers
expression "expression" =
first:param rest:(OWS FIELD_SEP OWS param)* {
return [first]
.concat(rest.map(entry => entry[3]))
.reduce((obj, entry) => Object.assign(obj, {[entry.label]: entry.value}), {})
}
param "param" =
label:label val:(OWS "=" OWS (number / label / string))? {
const op = { type: 'param', label: label.value };
@triblondon
triblondon / 1. INIT
Created August 3, 2018 15:24
Fiddle workshop snippets (exercise 7)
table auth_config {
"secret": "my-super-secret-string",
"sessionTTL": "3600"
}
list.split('\n')
.map(line => {
const parts = line.match(/<a href=['"](.*?)['"]>(.*?)\s+(\S+)\s*<\/a>/);
if (parts) {
return {givenName: parts[2], familyName: parts[3], url: parts[1]};
} else {
console.log(line);
}
})
.sort((a,b) => a['familyName'] > b['familyName'] ? 1 : -1)
curl -s "https://patch-diff.githubusercontent.com/raw/amp-letter/amp-letter.github.io/pull/[1-408].patch" | egrep "^\+\s+"
@triblondon
triblondon / auth.js
Created June 30, 2017 21:02
Vary middleware
'use strict';
const USER_ID_HEADER = 'Fastly-Auth-UserID';
const RANK_HEADER = 'Fastly-Auth-Rank';
const TOKEN_HEADER = 'Fastly-Auth-Token';
module.exports = () => {
return (req, res, next) => {
const uid = req.get(USER_ID_HEADER);
const rank = req.get(RANK_HEADER);
@triblondon
triblondon / apps-script.js
Last active August 31, 2022 11:43
Google apps script for form data to gsheet
// Submit form data directly to Google sheets
//
// (Based on http://railsrescue.com/blog/2015-05-28-step-by-step-setup-to-send-form-data-to-google-sheets/)
//
// ## Setup
//
// 1. Create a Google spreadsheet and name it
// 2. Choose Tools > Script editor
// 3. Replace the sample code with the contents of this file
// 4. Name the script project something like "Submit form data to Google sheet" (click on 'Untitled project' to change name)
@triblondon
triblondon / cla.md
Created November 17, 2016 02:29
CLA for Polyfill.io

All contributions to the polyfill service are made under the MIT licence. It is important therefore that you agree to the following when contributing code to the service:

  • Any contribution I make to the polyfill service by way of Pull Request contains only data that is:
    • wholly my own work, upon which I am legally permitted to grant a licence; or
    • wholly the work of individuals within the same organisation to which the copyright in all work created by employees is assigned, of which I am a current employee and authorised representive for the purposes of this contribution, and which is legally permitted to grant a licence; or
    • licensed by the original author under the MIT licence or equivalent terms
  • In respect of any part of my contribution that is not already available under an MIT or compatible licence, I hereby grant to the Financial Times Limited (FT) and to recipients of software distributed by the FT a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to make,
@triblondon
triblondon / about.md
Last active October 31, 2016 01:44
W3C TAG Developer summit

The W3C TAG (Technical Architecture Group) is in charge of coordinating cross-technology architecture and the principles of web architecture at the World Wide Web Consortium. In other words, it’s kind of a technical steering group for web standards. We’re having a face to face meeting in November in Tokyo (hosted by Nikkei).

As part of our time here we'll be holding an evening developer event (followed by party) on the evening of November 2nd where we can let you know what we're up to and get feedback from the web developer community about your priorities. The event is a partnership between Front End Meetup Tokyo and W3C/Keio. The format of the event will be as follows:

Time Description
18:30 Registration opens
19:00 Welcome, followed by four lightning talks (20 mins)
19:20 Break-out Sessions (1 hour)
20:20 Wrap-up session where we will summarize what has been discussed in the break-outs (15 mins)
I use Google Chrome, stable, version 52.