This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Example Task Manager Project | |
description: An example API documentation for a task manager. | |
version: "1.0" | |
servers: | |
- url: 'https://example.com/taskmanager/' | |
components: | |
schemas: | |
Task: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generates the spec into zero-dependency HTML file | |
redoc-cli bundle -o ~/desired/path/for/output/index.html ~/path/to/your/openapi.yaml | |
# Starts a server with spec rendered with ReDoc. Supports SSR mode (--ssr) and can watch the spec (--watch) | |
redoc-cli serve ~/path/to/your/openapi.yaml --watch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g redoc-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the prism server, you can set the port with -p to whatever you want | |
prism mock -p 4010 ~/path/to/your/openapi.yaml | |
# Now you can access the fake API endpoints | |
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json" | |
# If you have json_pp installed (available via Homebrew on macOS) you can even nicely format the response | |
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json" | json_pp | |
# You can also test specific response codes using the __code query string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g @stoplight/prism-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
description: | | |
This is a sample Petstore server. You can find | |
out more about Swagger at | |
[http://swagger.io](http://swagger.io) or on | |
[irc.freenode.net, #swagger](http://swagger.io/irc/). | |
version: 1.0.0 | |
title: Swagger Petstore | |
termsOfService: http://swagger.io/terms/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stream all lines from a log file | |
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines" | |
# Stream lines that contain 'fatal error' | |
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines" "fatal error" | |
# Run the script on a background thread | |
./tail-campfire.sh "/var/log/apache/example-site-error.log" "https://3.basecamp.com/.../lines" & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tail -n0 -F "$1" | while read LINE; do | |
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
"content=$(echo $LINE)" "$2"; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() async { | |
if (!kReleaseMode) { | |
// For Android devices you can also allowBadCertificates: true below, but you should ONLY do this when !kReleaseMode | |
final proxy = CustomProxy(ipAddress: "localhost", port: 8888); | |
proxy.enable(); | |
} | |
// Run app | |
runApp(MyApp()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:flutter/foundation.dart'; | |
/// Allows you to set and enable a proxy for your app | |
class CustomProxy { | |
/// A string representing an IP address for the proxy server | |
final String ipAddress; | |
/// The port number for the proxy server | |
/// Can be null if port is default. |