jq is useful to slice, filter, map and transform structured json data.
brew install jq
"""A sample to send message on Google Chat group with Python requests. | |
Prerequisites: | |
- Google API v1 | |
- A webhook URL taken | |
- Python 3 | |
- Requests (last tested with 2.31.0) | |
Usage: |
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |
// First, run the common tests | |
eval(globals.commonTests)(); | |
// Then run any request-specific tests | |
tests["Status code is 200"] = responseCode.code === 200; |
// Save common tests in a global variable | |
postman.setGlobalVariable("commonTests", () => { | |
// The Content-Type must be JSON | |
tests["Content-Type header is set"] = postman.getResponseHeader("Content-Type") === "application/json"; | |
// The response time must be less than 500 milliseconds | |
tests["Response time is acceptable"] = responseTime < 500; | |
// The response body must include an "id" property | |
var data = JSON.parse(responseBody); |
#!/usr/bin/env bash | |
# fresh-chrome | |
# | |
# Use this script on OS X to launch a new instance of Google Chrome | |
# with its own empty cache, cookies, and user configuration. | |
# | |
# The first time you run this script, it will launch a new Google | |
# Chrome instance with a permanent user-data directory, which you can | |
# customize below. Perform any initial setup you want to keep on every |
/** | |
* This code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |
""" This is a simple gist to show how to mock | |
private methods. I've got lots of questions | |
regarding this topic. Most people seems confused. | |
Hope it helps. | |
""" | |
import unittest | |
import mock |