Dev Tipshttps://dev-tips.com/Tips, tricks, techniques, tutorials, and tidbits for software developersen-USMon, 03 Jul 2023 22:06:11 +0000© Dev Tips 2023Use a .mailmap file to merge, consolidate, or replace author names and email addresses in Githttps://dev-tips.com/git/use-a-mailmap-file-to-merge-consolidate-or-replace-author-names-and-email-addresses-in-githttps://dev-tips.com/git/use-a-mailmap-file-to-merge-consolidate-or-replace-author-names-and-email-addresses-in-gitA handy trick to unify multiple author identities (i.e. names and email addresses) and simplify tracking commits, especially in teams with different machines or Git clients.Mon, 03 Jul 2023 20:56:03 +0000LTR/RTL text direction support and localized content examples in Storybookhttps://dev-tips.com/storybook/ltr-rtl-text-direction-support-and-localized-content-examples-in-storybookhttps://dev-tips.com/storybook/ltr-rtl-text-direction-support-and-localized-content-examples-in-storybookToggling stories and their content between LTR and RTL text direction in Storybook does not require an add-on and is possible using Storybook’s built-in global types.Fri, 03 Feb 2023 11:14:47 +0000Short-circuiting promises using timeouts in JavaScripthttps://dev-tips.com/javascript/short-circuiting-promises-using-timeouts-in-javascripthttps://dev-tips.com/javascript/short-circuiting-promises-using-timeouts-in-javascriptIn 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 CIhttps://dev-tips.com/gitlab/feature-branch-deployment-and-preview-environment-in-gitlab-cihttps://dev-tips.com/gitlab/feature-branch-deployment-and-preview-environment-in-gitlab-ciGitLab’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 macOShttps://dev-tips.com/git/rename-case-sensitive-files-in-git-on-macoshttps://dev-tips.com/git/rename-case-sensitive-files-in-git-on-macosAs 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 Reacthttps://dev-tips.com/react/passing-web-component-html-attributes-to-reacthttps://dev-tips.com/react/passing-web-component-html-attributes-to-reactWhen 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 commithttps://dev-tips.com/git/change-the-author-and-committer-of-a-git-commithttps://dev-tips.com/git/change-the-author-and-committer-of-a-git-commitGit 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 Githttps://dev-tips.com/git/anonymize-author-names-for-historical-commits-in-githttps://dev-tips.com/git/anonymize-author-names-for-historical-commits-in-gitWhen 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 TypeScripthttps://dev-tips.com/typescript/conditional-mandatory-properties-depending-on-other-properties-in-typescripthttps://dev-tips.com/typescript/conditional-mandatory-properties-depending-on-other-properties-in-typescriptLearn 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« patternhttps://dev-tips.com/javascript/resolving-javascript-promises-from-the-outside-using-the-deferred-patternhttps://dev-tips.com/javascript/resolving-javascript-promises-from-the-outside-using-the-deferred-patternNative 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« fileshttps://dev-tips.com/aws/exporting-outputs-from-cdk-and-cloudformation-to-environment-variables-or-dotenv-fileshttps://dev-tips.com/aws/exporting-outputs-from-cdk-and-cloudformation-to-environment-variables-or-dotenv-filesWhen 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 CDKhttps://dev-tips.com/aws/deploying-updates-to-ecs-fargate-services-for-every-ecr-push-with-aws-codepipeline-and-aws-cdkhttps://dev-tips.com/aws/deploying-updates-to-ecs-fargate-services-for-every-ecr-push-with-aws-codepipeline-and-aws-cdkHow 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 outputhttps://dev-tips.com/tools/using-jq-to-filter-json-outputhttps://dev-tips.com/tools/using-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« notationhttps://dev-tips.com/algorithms/big-o-notationhttps://dev-tips.com/algorithms/big-o-notationHow 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 Optimizelyhttps://dev-tips.com/frontend/a-b-tests-with-react-and-google-optimize-or-optimizelyhttps://dev-tips.com/frontend/a-b-tests-with-react-and-google-optimize-or-optimizelyDue 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 injectionhttps://dev-tips.com/frontend/modernize-legacy-frontends-from-inside-out-via-spa-injectionhttps://dev-tips.com/frontend/modernize-legacy-frontends-from-inside-out-via-spa-injectionBy 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 Componentshttps://dev-tips.com/react/rendering-react-applications-as-native-web-componentshttps://dev-tips.com/react/rendering-react-applications-as-native-web-componentsLearn 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 Jesthttps://dev-tips.com/jest/testing-multiple-values-using-table-driven-tests-in-jesthttps://dev-tips.com/jest/testing-multiple-values-using-table-driven-tests-in-jestHow 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 lintinghttps://dev-tips.com/gitlab/gitlab-ci-yaml-configuration-lintinghttps://dev-tips.com/gitlab/gitlab-ci-yaml-configuration-lintingIf 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 jobshttps://dev-tips.com/gitlab/sharing-extending-configuration-between-gitlab-ci-jobshttps://dev-tips.com/gitlab/sharing-extending-configuration-between-gitlab-ci-jobsHave 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 +0000