Skip to content

Instantly share code, notes, and snippets.

Tim Perry pimterry

Block or report user

Report or block pimterry

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View HTTP Toolkit CLA
# Contributor License Agreement
_Closely based on [the Ghost CLA](https://github.com/TryGhost/Ghost/blob/496f873ac49cd61fd15206252e9fcdf8a7c4f7c6/.github/CONTRIBUTING.md#contributor-license-agreement)_.
By contributing your code to this project you grant HTTP Toolkit a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license under all of Your relevant intellectual property rights (including copyright, patent, and any other rights), to use, copy, prepare derivative works of, distribute and publicly perform and display the Contributions on any licensing terms, including without limitation: (a) open source licenses like the MIT license; and (b) binary, proprietary, or commercial licenses. Except for the licenses granted herein, You reserve all right, title, and interest in and to the Contribution.
You confirm that you are able to grant us these rights. You represent that You are legally entitled to grant the above license. If Your employer has rights to intellectual property t
View Batched REST example.md

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
View gist:c00a6b5b6e0ef5eb972e525c441fca63
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?
@pimterry
pimterry / resin-set-build-by-tags.js
Last active Apr 13, 2018
Set the build for a set of resin.io devices by matching tag metadata
View resin-set-build-by-tags.js
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,
View stream-npm-publishes.js
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))
View fetch-get.js
fetch('https://xkcd.com/info.0.json')
.then((response) => response.json())
.then(console.log);
@pimterry
pimterry / .travis.yml
Created Dec 3, 2016
Travis config for running Bats tests
View .travis.yml
language: bash
script:
- ./test.sh
@pimterry
pimterry / notes-find-test.sh
Created Dec 3, 2016
A simple real bats test, using `run` to assert on status and output
View notes-find-test.sh
@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"
}
View gist:f375dc4859ec923530b778f6ebe111a6
git clone <your repo>
git submodule update --init --recursive
./test.sh
@pimterry
pimterry / dev.sh
Created Dec 3, 2016
Rerun all bats test automatically on change for quick dev feedback
View dev.sh
# Run this file (with 'entr' installed) to watch all files and rerun tests on changes
ls -d **/* | entr ./test.sh
You can’t perform that action at this time.