$ pnpm lint
/package.json | scripts: { "lint": "wireit" }
/package.json | wireit: "lint" => ["lint:root", "lint:pkgs"]
/package.json | scripts: { "lint:root": "wireit" }
/package.json | wireit: "lint:root" => "nps lint:base (files)"
/package-scripts.js | scripts: "lint:base" => "eslint (options)"
/package.json | scripts: { "lint:pkgs": "wireit" }
/package.json | wireit: "lint:pkgs" => ["packages/*] => "lint"
The following 2 examples compare and contrast the approach of a RESTful style API against an RPC-JSON style API.
We have an API that returns an HTTP 200 OK for successful calls. The content of the response is of the Type requested, in this example a Customer Type formatted as json.
Errors are returned using the HTTP status codes like 400 (bad request) and 500 (server error). The content of the response contains the error details formatted as json.
We have an API that returns an HTTP 200 OK for successful calls. The content of the response is a standard format that contains error information as well as a property of the Type requested.
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 | |
for i in $(grep -rv '^#' | grep '::set-output name=' | cut -d':' -f1); do | |
sed -i '' -e 's/::set-output name=\([^:]*\)::\(.*\)/\1=\2 >> ${GITHUB_OUTPUT}/' "${i}" | |
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
git push origin local-name:remote-name |
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
# Exports Terraform outputs into an environment file that can be sourced into shell | |
# Supports Terraform 0.12+ (also works with Terragrunt 19+) | |
# | |
# It can be useful to export tf outputs into a .env file for use with serverless, jenkins, and node | |
# to use with tools that directly support dotenv, remove the "export " from the prefix | |
# | |
# Steps | |
# 1. Gets the terraform output | |
# 2. Add quotes to the right hand side of equals | |
# 3. Remove spaces around equal signs |
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
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3(); | |
function getObjects({ bucket, marker, prev }, callback) { | |
var params = { | |
Bucket: bucket, | |
Marker: marker, | |
} | |
return s3.listObjects(params).promise().then(data => { |
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
function go(id) { | |
return new Promise((resolve, reject) => { | |
console.log('promise entered', id); | |
const rnd = Math.random() * 500; | |
setTimeout(() => { | |
resolve('resolved'); | |
}, rnd); | |
}); | |
} |
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
const csv = require('fast-csv'); | |
const HeaderValidationError = require('./headerValidationError'); | |
/** | |
* TODO: missing features | |
* Check for missing condtl data | |
* Check for missing exclusive condtl data | |
* Check for invalid characters in headers | |
* Test for non-joi validation | |
* Joi helper should export custom joi instance |
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
const marky = require('marky'); | |
const fs = require('fs'); | |
const Joi = require('joi'); | |
const CSVStreamParser = require('./csvStreamParser.js'); | |
const FILENAME = './files/single.csv'; | |
const input = fs.createReadStream(FILENAME); | |
const CENSUS_ATTR_MAP = { | |
lastname: 'lastName', |
NewerOlder