Skip to content

Instantly share code, notes, and snippets.

@quezak
quezak / compile-contracts.sh
Created March 15, 2021 14:15
Run waffle & typechain only if contract files changed
#!/bin/bash
# Run waffle, but only if any contracts were changed -- to save time on hot reloading.
CONTRACTS_BUILD_DIR="set path to your contract ABI jsons directory here (or read from script args)"
CONTRACTS_SOURCES_DIR="set path to your solidity files directory here"
found_updates=false
for contract_file in $(find "$CONTRACTS_SOURCES_DIR" -name '*.sol'); do
# grep on alpine images doesn't support PCRE (grep -P switch), use awk instead
# for contract_name in $(grep -Poh '(?<=^contract )\w+' "$contract_file"); do
@quezak
quezak / context-handler-example.ts
Last active April 30, 2020 10:32
cls-hooked usage example: context tagged logs
// How to use cls-hooked, for example to tag logs with some useful request context.
// (https://github.com/Jeff-Lewis/cls-hooked)
// Confirmed to work correctly in production using Node 12.4.
//
// Author: github.com/quezak/, cheers from Ramp Network 💚💙
// -----------------------------------
// context-handler.ts
// -----------------------------------
@quezak
quezak / test.json
Created May 17, 2019 09:39
openapi generator schema example with different return types for different codes
{
"swagger": "2.0",
"host": "test.test",
"schemes": ["https"],
"info": { "version": "1.0", "title": "Test" },
"paths": {
"/test": {
"get": {
"summary": "Test",
"description": "Test",