LIST

Debug typescript file with breakpoints (credentials via 1password)

because: aws credentials - don’t store plaintext op run -- node inspect -r ts-node/register hello.test.ts (src: Debugger _ Node.js v18.9.0 Documentation & AWS & Typescript Masterclass - Testing and debugging Lambdas #31) From the terminal itself (src: How To Debug Node.js with the Built-In Debugger and Chrome DevTools _ DigitalOcean) from intellij (Run_Debug Configuration_ Attach to Node.js_Chrome _ IntelliJ IDEA) inspired by the AWS Toolkit for IntelliJ...

September 9, 2022

aws credentials - don't store plaintext

prerequisites aws cli 1password v8 with cli enabled optional direnv for folder specific config (export env var) export AWS_ACCESS_KEY_ID=op://your-vault-name/AWS_CLI/username export AWS_SECRET_ACCESS_KEY=op://your-vault-name/AWS_CLI/credential alias aws="op run -- /usr/local/bin/aws" alias cdk="op run -- /usr/local/bin/cdk" alias sam="op run -- /usr/local/bin/sam" alias ts-node="op run -- node -r ts-node/register" Done you can now run aws commands aws s3 ls

September 7, 2022

CLI: grab table of contents on a site

[ ...document.querySelectorAll('.section--section-title--8blTh') ].map(e=>e.outerText) (where the html element has the class ‘section–section-title–8blTh’

September 7, 2022

Course: AWS & Typescript Masterclass - CDK, Serverless, React

(AWS & Typescript Masterclass - CDK, Serverless, React) Section 1: Introduction Section 2: AWS CDK & CloudFormation CDK commands Backend Section 3: Serverless project with CDK and Typescript Section 4: Serverless: AWS Lambda - bundling, testing and debugging Section 5: Testing and debugging Lambdas cdk run local lambda with sam-cli Debug typescript file with breakpoints (credentials via 1password) Section 6: AWS DynamoDb with CDK and Lambda Type Guards Section 7: [[aws-typescript-masterclass-7....

September 7, 2022

Code: contentful gatsby graphql filter elemMatch AND multiple

If I use the following filter, it’s OR filter: {tags: {elemMatch: {contentful_id: {eq: $tagId}, name: {eq: "published"}}}} because filters over multiple fields are OR filter: { tags: { elemMatch: { contentful_id: { eq: $tagId }, name: { eq: "published" } } } } resulting in tag.id === $tagId OR tag.name === “published” If instead I use (abuse) the different matcher things for the same field, it is AND filter: {tags: {elemMatch: {contentful_id: {}, name: {eq: "published", in: "i....

December 12, 2020

Code snippets from GregYoung 8 CQRS Class

Code snippets from GregYoung 8 CQRS Class - YouTube public class DeactivateInventoryItemCommand { public readonly Guid InventoryItemId; public readonly string Comment; public DeactivateInventoryItemCommand (Guid id, string comment) { InventoryItemId = id; Comment = comment; } void DeactivateInventoryItem(Guid, string comment) CommandHandler contains no logic, logic is in domain object delegates to domain object public class DeactivateInventoryItemHandler : Handles<DeactivateInventoryItem> { public DeactivateInventoryItemHandler(InventoryItemRepository rep){} void Handle(DeactivateInventoryItem cmd) { var item = repository.GetById(cmd.Id); item.Deactivate(cmd.Comment); } } Application Services cross-cutting concerns (logging, authentication)...

March 16, 2019

original code snippets from GregYoung 8 CQRS Class

Code snippets from GregYoung 8 CQRS Class - YouTube public class DeactivateInventoryItemCommand { public readonly Guid InventoryItemId; public readonly string Comment; public DeactivateInventoryItemCommand (Guid id, string comment) { InventoryItemId = id; Comment = comment; } void DeactivateInventoryItem(Guid, string comment) CommandHandler contains no logic, logic is in domain object delegates to domain object public class DeactivateInventoryItemHandler : Handles<DeactivateInventoryItem> { public DeactivateInventoryItemHandler(InventoryItemRepository rep){} void Handle(DeactivateInventoryItem cmd) { var item = repository.GetById(cmd.Id); item....

March 16, 2019