Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Phil Sturgeon philsturgeon

🏠
Working from home
View GitHub Profile
View .spectral.yaml
rules:
cache-control-undocumented:
description: |-
Cache usage MUST be extensively detailed in the `description` property
to avoid data leaks or the usage of stale data.
This rule should ensure in some way that the api provider
documented extensively the cache usage to avoid data leaks
or usage of stale data.
@philsturgeon
philsturgeon / giphy.bundled.yaml
Last active Mar 10, 2020
OpenAPI $ref Resolution: Bundling vs Dereferencing
View giphy.bundled.yaml
swagger: '2.0'
schemes:
- https
host: api.giphy.com
basePath: /v1
info:
contact:
email: support@giphy.com
description: Giphy API phantom change
termsOfService: 'https://developers.giphy.com/'
View Treeware.md

Treeware

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees here offset.earth/treeware

Read more about Treeware at treeware.earth

@philsturgeon
philsturgeon / cloudSettings
Last active May 29, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-05-29T11:26:30.695Z","extensionVersion":"v3.4.3"}
@philsturgeon
philsturgeon / gist.md
Last active Feb 23, 2019
OpenAPI specifications style guide / file format
View gist.md

API Specs & Docs

Style Guide

A lot of this information has been used to create linting rules for [Speccy], so just run the linter with --rules=strict for advice. It will be updated over time, as new rules are created.

File Structure

OpenAPI supports JSON Pointer via $ref keys, even when you’re writing in YAML. Swagger.io has a great guide for $ref and JSON Pointer.

@philsturgeon
philsturgeon / Gemfile
Created Dec 14, 2017
Faraday Adapters Benchmark
View Gemfile
source 'https://rubygems.org'
gem 'faraday'
gem 'net-http-persistent'
gem 'typhoeus'
gem 'patron'
gem 'httpclient'
gem 'net-http2'
@philsturgeon
philsturgeon / wtf.md
Last active Dec 7, 2017
Postman disagrees with itself
View wtf.md

Hey, I’m super lost.

Currently im trying to make API Flow work:

https://github.com/luckymarmot/API-Flow/issues/149

There is an output.json which is a test case, and accoring to Postmans JSON Schema it is invalid.

I'm fixing a few (headers cannot have a null value) but the auth section is triggering errors. It looks like this:

View gist:bfabe7461ec6faf9457b6a75f25c0d9c
class Api::V3::CompanyPresenter
attr_accessor :company, :includes
def initialize(company, includes: [])
@company = company
@includes = Array(includes)
end
def as_json
{
@philsturgeon
philsturgeon / gist:64f7b611a035084b39673853c7e43f0d
Last active Jun 8, 2017
Janky Quick Example of RPC API being cool
View gist:64f7b611a035084b39673853c7e43f0d

POST /check-v1

Request

{
  "user_uuid" : "12345",
  "policy_action" : "do-a-thing"
}
View shitly formatted snippet.md

Taken verbatim from https://www.congress.gov/bill/114th-congress/house-bill/2029/text

   TITLE <<NOTE: Visa Waiver Program Improvement and Terrorist Travel 
  Prevention Act of 2015.>>  II--TERRORIST TRAVEL PREVENTION AND VISA 
WAIVER PROGRAM REFORM
SEC. 201. <<NOTE: 8 USC 1101 note.>> SHORT TITLE.

    This title may be cited as the ``Visa Waiver Program Improvement and 
Terrorist Travel Prevention Act of 2015''.
You can’t perform that action at this time.