Skip to content

Instantly share code, notes, and snippets.

View pursonchen's full-sized avatar
🏠
Working from home

pursonchen

🏠
Working from home
View GitHub Profile
@unwitting
unwitting / prerequest_script.js
Last active September 21, 2022 04:05
Postman pre-request script to dynamically sign outgoing requests to the API at trip.skyscanner.com
/**
* The below requires two bits of setup in Postman:
*
* 1. An environment variable named `TRIP_COM_API_CLIENT_SECRET` set to your client secret for the API
* 2. A request parameter named `signature` set to the value `{{_SIGNATURE}}` - this will be set by this script
*/
// Mostly copy-pastad from Stack Overflow since Postman doesn't seem to offer an out-of-the-box
// library for URL query param parsing, go figure
@gunnarlium
gunnarlium / guzzle-retry.php
Created December 17, 2015 16:23
Example of how to create a retry subscriber for Guzzle 6
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Request as Psr7Request;
use GuzzleHttp\Psr7\Response as Psr7Response;
use Psr\Log\LoggerInterface;
const MAX_RETRIES = 2;