I have to hold my breath for too long, maybe not so good for my health.
if (a) {| #!/bin/sh | |
| # this script will look into current staged (about to be commited) files | |
| # searching for the pattern from $1 | |
| # if found, would exit with error status code 1 | |
| # Usage: | |
| # when staged files contain the search pattern 'TEST' | |
| # | |
| # > ./grepPattern.sh TEST |
| #!/bin/sh | |
| # this script will run eslint against staged files | |
| # in staged flies | |
| # find (M)odified and (A)dded file names, | |
| # find those conotains "src" or "test" | |
| toLint=$(git diff --name-status --cached | grep -E "^[M|A]" | awk '{print $2}' | grep -E "src|test") | |
| if [ -z "$toLint" ]; then |
| /* eslint-disable max-classes-per-file */ | |
| class Repo { | |
| constructor() { | |
| this.name = 'maomao'; | |
| } | |
| work(p1, p2) { | |
| return (p1 + p2); | |
| } |
| const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
| const exponentialBackOff = async (func, maxRetry, delay) => { | |
| let res = await func(); | |
| if (res) { | |
| return res; | |
| } | |
| console.log(`retrying, maxRetry ${maxRetry}`); |
| // system imports | |
| // 3rd party imports | |
| const { getSignedUrl } = require('@aws-sdk/s3-request-presigner') | |
| const { S3Client, GetObjectCommand } = require('@aws-sdk/client-s3') | |
| // local imports | |
| const client = new S3Client({ | |
| region: 'eu-west-1', // region, since s3 is global, guess it doesn't really matter :) | |
| credentials: { // this credential should have read access to the bucket/object you want to grant temp access to the user | |
| accessKeyId: 'AKIAIOSFODNN7EXAMPLE', |
A list of pluralsight courses to get a developer ready for backend tasks in alyne. Node.js courses should be 1st priority, you can take the others in order of your own preference and focus of work.
| plus(1, 2) // this won't complain, as add() is hoisted | |
| minus(2, 1) // this will complain, as minus is defined later | |
| // expression | |
| function plus(x, y) { | |
| return x + y; | |
| } | |
| // declaration | |
| const minus = function (x, y) { |