Skip to content

Instantly share code, notes, and snippets.

View pimterry's full-sized avatar
👶
50% parental leave, not going to be very responsive for a while

Tim Perry pimterry

👶
50% parental leave, not going to be very responsive for a while
View GitHub Profile
@pimterry
pimterry / test.sh
Last active December 3, 2016 17:56
Run all bats tests
# Run this file to run all the tests, once
./test/libs/bats/bin/bats test/*.bats
@pimterry
pimterry / dev.sh
Created December 3, 2016 18:02
Rerun all bats test automatically on change for quick dev feedback
# Run this file (with 'entr' installed) to watch all files and rerun tests on changes
ls -d **/* | entr ./test.sh
git clone <your repo>
git submodule update --init --recursive
./test.sh
@pimterry
pimterry / notes-find-test.sh
Created December 3, 2016 18:14
A simple real bats test, using `run` to assert on status and output
@test "Should show matching notes only if a pattern is provided to find" {
touch $NOTES_DIRECTORY/match-note1.md
touch $NOTES_DIRECTORY/hide-note2.md
run $notes find "match"
assert_success
assert_line "match-note1.md"
refute_line "hide-note2.md"
}
@pimterry
pimterry / .travis.yml
Created December 3, 2016 18:18
Travis config for running Bats tests
language: bash
script:
- ./test.sh
fetch('https://xkcd.com/info.0.json')
.then((response) => response.json())
.then(console.log);
const fetch = require('node-fetch');
// Connect to the npm registry, and stream back results to the console every time a package is published
fetch('https://skimdb.npmjs.com/registry/_changes?since=now&feed=continuous&filter=_view&view=app/updated')
.then((response) => response.body.pipe(process.stdout))
@pimterry
pimterry / resin-set-build-by-tags.js
Last active April 13, 2018 14:04
Set the build for a set of resin.io devices by matching tag metadata
let APP_ID = ...;
let TAG_KEY = ...;
let TAG_VALUE = ...; // Remove this and its use below to ignore the value
let TARGET_ID = ...; // Build id (not commit hash)
sdk.pine.patch({
resource: 'device',
options: {
filter: {
belongs_to__application: APP_ID,
Hi,
I'm afraid I'm not interested in this position right now.
I would like to know how you're getting my details and what you're storing though. Under my rights from the GDPR, can you please tell me:
* what personal data you have collected about me?
* the source of this data?
* who you've shared it with, and under what basis?
* how this data is being used?

A Proposal for Batched REST

An alternative to both REST & GraphQL, combining the benefits of each, based on https://tools.ietf.org/id/draft-snell-http-batch-00.html.

Batch multiple related requests into one HTTP request, which can be sent once & processed once on the server-side, but otherwise keep all the benefits of REST & HTTP. This is one single raw HTTP request:

POST /batch
Host: example.com
Content-Type: multipart/batch