Dev Tips, tricks, techniques, tutorials, and tidbits for software developersen-USTue, 04 Oct 2022 07:54:09 +0000© Dev Tips 2022Short-circuiting promises using timeouts in JavaScript case a promise may need too long to resolve, short-circuiting it using a timeout ensures good and fail-safe user experience.Fri, 20 May 2022 14:39:46 +0000Feature branch deployment and preview environment in GitLab CI’s built-in environment capabilities facilitate feature branch deployments of both static applications (e.g. SPAs, Storybook, SSG) and dynamic applications.Tue, 29 Mar 2022 21:24:47 +0000Rename case-sensitive files in Git on macOS macOS is case-insensitive, simply renaming a file won’t be recognized as a change in Git. This can be handled by using »git mv« instead.Sun, 02 Jan 2022 20:53:09 +0000Passing Web Component HTML attributes to React wrapping React into a native Web Component, you may want to pass HTML attributes of the custom element to your React component/application in order to work with these values.Fri, 12 Nov 2021 09:51:57 +0000Change the author and committer of a Git commit allows to set/change the name and email address of both the author and committer of a commits. This can be helpful if you need to commit someone else’s work.Wed, 27 Oct 2021 06:28:30 +0000Anonymize author names for historical commits in Git handing off a repository (e.g. to another company), you may want or need to pay attention to privacy concerns like names and email addresses of developers in the repository history. Using rebasing, you can anonymize author names in a quick and automated way.Tue, 26 Oct 2021 20:29:31 +0000Conditional mandatory properties depending on other properties in TypeScript how you can facilitate union types to implement types where the necessity of specific properties can be defined depending on other properties in the same type.Mon, 18 Oct 2021 10:12:42 +0000Resolving JavaScript promises from the outside using the »Deferred« pattern promises in JavaScript don’t expose public »resolve« and »reject« methods. However, if you need to resolve a promise from the outside, e.g. to pause or delay asynchronous operations, you can simply use a custom »Deferred« class.Sat, 03 Jul 2021 21:19:14 +0000Exporting outputs from CDK and CloudFormation to environment variables or ».env« files running an application involving different services on AWS, you may need to export infrastructure output (e.g. API endpoints) as environment variables or ».env« files for further use (e.g. SPA frontends such as React or Vue.js).Sat, 26 Jun 2021 21:19:14 +0000Deploying updates to ECS Fargate services for every ECR push with AWS CodePipeline and AWS CDK to setup your AWS ECS Fargate service so it automatically gets re-deployed once its ECR image gets updated for continuous delivery with AWS CodePipeline in AWS CDK.Sun, 20 Jun 2021 09:12:44 +0000Using »jq« to filter JSON output»jq« is a lightweight command-line JSON processor based on the concept of filters operating over a JSON stream. There are numerous predefined functions/filters that can easily be combined using pipes to quickly create and apply complex operations and transformations.Sat, 12 Jun 2021 15:45:01 +0000»Big O« notation the notation works, what it is used for, and examples for the most common time complexities (constant, linear, logarithmic, quadratic, and exponential) in JavaScript.Sat, 05 Jun 2021 19:11:34 +0000A/B tests with React and Google Optimize or Optimizely to React re-rendering the DOM autonomously (and thus unpredictably), it’s not possible to use the usual WYSIWYG (»What You See Is What You Get«) approach of A/B testing tools like Google Optimize or Optimizely used by non-developers to maintain A/B tests.Sat, 29 May 2021 09:23:30 +0000Modernize legacy frontends from inside-out via SPA injection embedding a new single-page application (SPA) into a legacy website or application and slowly expanding its functionality, you can modernize frontends from inside-out.Sat, 22 May 2021 23:30:09 +0000Rendering React applications as native Web Components how to render a React application created with »Create React App« in an isolated native Web Component to make use of Shadow DOM and encapsulate your application, e.g. for micro-frontend architectures or SPA injection.Sat, 15 May 2021 11:47:53 +0000Testing multiple values using table-driven tests in Jest table-driven tests in Jest can help you avoiding writing boilerplate for similar test cases.Sun, 09 May 2021 09:44:56 +0000GitLab CI YAML configuration linting you want to test the validity of a GitLab CI YAML configuration before committing it to the repository, GitLab provides a built-in linting tool that allows checking for syntax/logical errors.Sat, 01 May 2021 17:01:04 +0000Sharing/Extending configuration between GitLab CI jobs you ever wanted to execute a GitLab CI job for multiple environments and copied blocks of YAML several times? YAML anchors, extending, and hidden keys to rescue!Sat, 24 Apr 2021 09:34:21 +0000Building Docker images in GitLab CI GitLab CI runners (usually) are running as Docker containers themselves, it’s possible and straightforward to build Docker images in GitLab CI pipelines and push them to either GitLab’s internal container registry or external registries like AWS ECR or GCR.Sun, 18 Apr 2021 21:43:54 +0000Difference between caches and artifacts in GitLab CI with different pipelines or multiple jobs in a single pipeline, GitLab CI’s caches and artifacts may have crossed your way. But what is the actual difference and when to use what?Sat, 10 Apr 2021 13:05:24 +0000