Skip to content

Instantly share code, notes, and snippets.

View tbarn's full-sized avatar
🤔
probably judging your docs

Taylor Barnett-Torabi tbarn

🤔
probably judging your docs
View GitHub Profile
const { RuleFunction, Spectral } = require('@stoplight/spectral');
const spectral = new Spectral();
spectral.addRules({
snake_case: {
summary: ‘Checks for snake case pattern’,
// evaluate every property
@tbarn
tbarn / test-oas3.js
Last active March 12, 2019 00:47
This is an example of linting an OpenAPI 3 document with Spectral and Node.js
// This example is designed to be using Spectral (https://github.com/stoplightio/spectral#installation) and Node.js (https://nodejs.org/)
// If you have both installed locally, it can be run with the command: node test-oas3.js
const { Spectral } = require('@stoplight/spectral');
const { oas3Functions, oas3Rules } = require('@stoplight/spectral/rulesets/oas3');
// an OAS 3 document
var myOAS = {
"openapi": "3.0.0",
@tbarn
tbarn / auto-collector-snippet.js
Created April 19, 2017 18:58
Keen IO Auto-Collector Installation
<script type="text/javascript">
function createKeenWebAutoCollector(){window.keenWebAutoCollector=window.KeenWebAutoCollector.create({projectId:'<YOUR_PROJECT_ID>',writeKey:'<YOUR_WRITE_KEY>',onloadCallbacks:window.keenWebAutoCollector.onloadCallbacks}),window.keenWebAutoCollector.loaded()}function initKeenWebAutoCollector(){window.keenWebAutoCollector.domReady()?window.createKeenWebAutoCollector():document.addEventListener("readystatechange",function(){window.keenWebAutoCollector.domReady()&&window.createKeenWebAutoCollector()})}window.keenWebAutoCollector={onloadCallbacks:[],onload:function(a){this.onloadCallbacks.push(a)},domReady:function(){return["ready","complete"].indexOf(document.readyState)>-1}};
</script>
<script async type="text/javascript" src="https://d26b395fwzu5fz.cloudfront.net/keen-web-autocollector-1.0.8.min.js" onload="initKeenWebAutoCollector()"></script>