Skip to content

Instantly share code, notes, and snippets.

View ponelat's full-sized avatar

Josh Ponelat ponelat

View GitHub Profile
@ponelat
ponelat / gist:08187dc9ef69468728d4c5a73bb471c6
Last active July 15, 2016 07:50
Clean docker ( oneline )
sudo docker rm -v $(sudo docker ps -a -q -f status=exited); sudo docker rmi $(sudo docker images -f "dangling=true" -q); sudo docker volume rm $(sudo docker volume ls -qf dangling=true)
{"swagger":"2.0","info":{"description":"This is an online swagger codegen server. You can find out more at https://github.com/swagger-api/swagger-codegen or on [irc.freenode.net, #swagger](http://swagger.io/irc/).","version":"2.2.0-SNAPSHOT","title":"Swagger Generator","termsOfService":"http://swagger.io/terms/","contact":{"name":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"basePath":"/api","tags":[{"name":"gen"},{"name":"clients"},{"name":"servers"}],"paths":{"/gen/clients":{"get":{"tags":["clients"],"summary":"Gets languages supported by the client generator","description":"","operationId":"clientOptions","parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"type":"string"}}}}}},"/gen/clients/{language}":{"get":{"tags":["clients"],"summary":"Returns options for a client library","description":"","operationId":"getClientOptions","produces":["application/json"],"parameters":[{"name":"langu
{"swagger":"2.0","info":{"description":"This is an online swagger codegen server. You can find out more at https://github.com/swagger-api/swagger-codegen or on [irc.freenode.net, #swagger](http://swagger.io/irc/).","version":"2.2.0-SNAPSHOT","title":"Swagger Generator","termsOfService":"http://swagger.io/terms/","contact":{"name":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"basePath":"/api","tags":[{"name":"gen"},{"name":"clients"},{"name":"servers"}],"paths":{"/gen/clients":{"get":{"tags":["clients"],"summary":"Gets languages supported by the client generator","description":"","operationId":"clientOptions","parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"type":"string"}}}}}},"/gen/clients/{language}":{"get":{"tags":["clients"],"summary":"Returns options for a client library","description":"","operationId":"getClientOptions","produces":["application/json"],"parameters":[{"name":"langu
@ponelat
ponelat / docker-clean.sh
Last active August 5, 2016 15:53
docker clean
#!/bin/sh
# Run with...
# Use the raw github link ( there will be a button on this page)
# curl -sL https://gist.githubusercontent.com/.... | sudo bash
echo ====================================================
docker rm -v $(docker ps -a -q -f status=exited) || echo 'No containers to clean up with status=exited'
echo ====================================================
docker rmi $(docker images -f "dangling=true" -q) || echo 'No images to clean up with dangling=true'
{
"swagger": "2.0",
"info": {
"title": "Valid JSON"
}
}
@ponelat
ponelat / invalid.json
Last active September 28, 2016 04:38
{
"swagger": "2.0",
"info": {
"title": not [ quite valid....
}
}
a[ one # two
{ "fromTheGist": true }
//...
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
authorizations: {
someName: function() {
// This function will get called /before/ each request
// ... UNLESS you have a 'security' tag in the swagger.json file, in which case you must add 'someName' to the list of auths.
console.log('explore the request object...',this) // Take a look in the console tab to see what's available.
this.headers['x-swagger'] = 'value'; // Example header
@ponelat
ponelat / index.html
Created May 3, 2015 10:20
Basic sending of an api_key
<script src='browser/swagger-client.js' type='text/javascript'></script>
<script type="text/javascript">
// initialize swagger, point to a resource listing
window.swagger = new SwaggerClient({
url: "http://petstore.swagger.io/api/api-docs",
success: function() {
// This will add a query parameter called api_key with the value 'special-key'
this.clientAuthorizations.add("api_key", new client.ApiKeyAuthorization("api_key","special-key","query"));