usr/bin/env bash
set -euo pipefail
check_bash_version() {
if [[ ${BASH_VERSINFO[0]} -lt 5 ]]; then
echo "Error: At least Bash version 5 is required."
echo "Your Bash version is: ${BASH_VERSINFO[0]}"
exit 1
#!/usr/bin/env bash
set -euo pipefail
declare -A hash_set
# Add elements to the hash set
hash_set["name1"]="Matthew"
hash_set["name2"]="Luke"
get_person_details() {
local name="John"
local age=25
# Return the values
echo "$name $age"
}
# Extract the values from the func
-
For macOS,
brew install gnupg
-
Follow instructions here https://docs.gitlab.com/ee/user/project/repository/signed_commits/gpg.html
-
Your .gitconfig should look like this:
[user]
import * as polyline from '@mapbox/polyline';
/**
* coords is encoded using the Google Maps algorithm for polyline encoding. See
* https://developers.google.com/maps/documentation/utilities/polylinealgorithm
* Use this for decoding https://www.npmjs.com/package/@mapbox/polyline
// npm i date-fns-tz
import { utcToZonedTime, format as utcFormat } from 'date-fns-tz'
const main = async (): Promise<void> => {
const dateInUtc: Date = utcToZonedTime(new Date(), 'UTC')
const formattedDateInUTC = utcFormat(dateInUtc, 'yyyy-MM-dd\'T\'HH:mm:ss\'Z\'', { timeZone: 'UTC' })
branch prefix | desc | touches prod code |
---|---|---|
+:refs/heads/(feature/*) | add new feature | Y |
+:refs/heads/(fix/), +:refs/heads/(hotfix/) | bug fix | Y |
+:refs/heads/(refactor/*) | change code.e.g. renaming a variable | Y |
+:refs/heads/(docs/*) | changes to docs | N |
+:refs/heads/(style/*) | formatting, missing semi colons | N |
+:refs/heads/(test/*) | adding missing tests, refactoring tests | N |
+:refs/heads/(chore/*) | updating build scripts | N |
Say you have a class named AbcClass
.
If AbcClass
depends on AnotherClass
, and AnotherClass
eventually needs to make a network call (e.g. to S3, Databse, GIS, some other party), then don't instantiate AnotherClass
inside AbcClass
.
AnotherClass
should be injected into the constructor of AbcClass
.
Say AnotherClass
is instantiated inside AbcClass
.
When you write a test for AbcClass
, AnotherClass
will inevitably make a network call.
NewerOlder