Skip to content

This Dot Blog

This Dot provides teams with technical leaders who bring deep knowledge of the web platform. We help teams set new standards, and deliver results predictably.

Newest First
Tags: Tips
How Vim Transformed My Workflow for the Better cover image

How Vim Transformed My Workflow for the Better

Discover how diving into Vim transformed my coding workflow...

Web Scraping with Deno cover image

Web Scraping with Deno

TypeScript is a great choice for writing a web scraper, but using it and web APIs in Node is kind of a pain. But there's an alternative: web scraping with Deno!...

Understanding RegEx cover image

Understanding RegEx

RegEx, an abbreviation of "regular expressions", are a set of characters which are used to create patterns that can be used to search, find, replace, or validate text. RegEx is language agnostic, although some features are not available to some languages. You can test out RegEx here before putting it in your code. We will look at some examples: RegEx: /dog/ Text: "The dog is big dog" Regular expressions start with a forward slash / followed by the pattern we want to match, and another forward slash / to end it. In this first example, we want to match a simple pattern: "dog". Our RegEx will highlight the first pattern it matches, which is the bold character in there.  Sometimes, we want our RegEx to highlight not only the first pattern, but all the patterns that can be found in the string. This is where expression flags are introduced. Expression flags are always introduced after the last forward slash. We will use the global expression flag to identify all patterns. RegEx: /dog/g Text: "The dog is big dog" With the global flag, our pattern identifies all the characters in this string. Here are some different expression flags that can be used. * g - The global expression flag, identifies all the pattern in the text * i - The case insensitive flag, identifies a pattern regardless of the case (either lower case or upper case) * m - The multi line match, identifies a pattern that spans multiple lines RegEx: /\d/ or /[0-9]/ Text: "1 2343" There are two ways to match numbers: the first one, \d, is a pattern that matches any single decimal number. The d is case sensitive- the backward slash is used to escape the character d, which can be used to identify only decimal numbers. The second one [0-9] also matches any decimal number, but in a different way, it starts and ends with a square bracket. We will touch more on square brackets soon. However, we want to identify a number from 0–9. So, like this indicates, we can also do [4-9], which means it will identify a number from 4–9, so it will have this instead of "12343". If we want to identify a concurrent number, we will have to use some commands.  RegEx: /\d+/ or /[0-9]+/ Text: "12343" Adding + to our pattern will highlight all the numbers because it means match 1 or more of the preceding pattern. Commands can help a lot when writing RegEx. I will display a command cheat sheet below. Commands cheat sheat |Command | Description | Pattern | Matches | |-----------|--------------------------------------------------------------------|-------------|------------------------| | . | Matches any character |c.c | cac, cbc, cgc, cdc, cfc| | * | Matches 0 or more of the preceding token |cat\d* | cat, cat24, cat56 | | + | Matches 1 or more of the preceding token |cat\d* | cat24, cat56 | | ? | Matches 0 or 1 of the preceding token |cat\d* | cat, cat5 | | ^ | Matches beginning of the text |^cat | catdaddy, cat mummy | | $ | Matches end of the text |^os | los, lagos | | [...] | Matches any pattern in the brackets |[0-9xyz] | x, y, 1 | | [^...] | Matches any pattern not in the brackets |[^0-9xyz] | a, b, cd | | [a-z] | Matches any character within that range |[0-9] | 0, 1, 2, 3 | | {a} | Matches a preceding pattern a number of (a) times |cat{2} | catcat | | {a,} | Matches a preceding pattern a number of (a) times or more |cat{2,} | catcat, catcatcatcat | | {a,b} | Matches a preceding pattern between a or b |cat{1,2} | cat, catcat | | . | Matches any character |co.l | cool, coal | | | | OR operator |cat|dog | cat or dog | With the commands above, we can create complex Regex: Alphanumeric texts RegEx: /[0-9A-Za-z]+/ Text: "bensoN123" Twitter Handle Twitter handles contain numbers, letters, and underscores, but start with @. RegEx: /^@[0-9A-Za-z_]+/ Text: "@bensoN123" Simple Email Validation RegEx: /^[\w]+@[\w]+.[a-zA-Z]{2,4}$/ Text: "" RegEx can be complicated at first, but the more you work with it, the easier it gets. You can explore more options, like negative look behind, and positive look ahead. If you have more questions, be free to reach out to me through my Github....

Git Basics: Diff and Stash cover image

Git Basics: Diff and Stash

Getting started with Git Today’s article will cover some of the basics of Git. This article is written under the assumption that you have already made a GitHub repository or have access to one, and that you also have a basic understanding of the command line. If you haven’t opened up a GitHub account, I recommend going to GitHub, creating an account, setting up a repository and following this guide before continuing on. Now, we’ll move on to a brief rundown of the Git commands that will be used in this article, and then follow it up with how to use each of them. The Rundown *Git diff* - This command is used to show changes between commits and the working tree. *Git stash* - This command is used to stash or remove the changes made to your working directory (no worries these haven’t gone up in smoke) *Git stash pop* - This command is used to retrieve your most recent stash made by popping it from your stash stack *Git stash list* - This command is used to display a list of your current stash entries. *Git stash apply* - This command is used to reapply a git stash, but also keep it in your stash Git Diff Alright, now we’re going to move on to how to do a *git diff*. I’m going to be going to my console, and heading over to the blog repo I used last time. From here, I’m going to open up my README file with nano and edit it. After saving, I’ll use a *git status* to verify that the changes are showing up. Now, we can see that the file is edited, but say we don’t know or remember what was changed. In this instance, we can use a *git diff*, and it’ll show us the changes that were made. *Git status* *Git diff* Git Stash Say we decide we don’t want or need those README changes at the moment we can use a *git stash*. With that done, we’ll use *git status*, and we can see that those changes are gone. While the change do appear to be gone, we can easily retrieve it by doing *git stash pop*. Once again, we’ll use *git status*, and verify that the changes are back. *Git stash* *Git status* *Git stash pop* *Git status again* Git stash list & apply Alright, so we’re going to do a *git stash* again to get rid of our current changes. We’re going to edit the README with nano again. We’ll run another *git status* to verify the changes were made. Then, we’re going to do another *git stash* to get rid of those changes. Now, with a couple of changes stashed, we’re going to do a *git stash list* to see our list of stashed changes. *Git stash* *Nano changes and git status* *Git stash again* *Git stash list* Now we want our initial changes. In order to get those, we’ll use a *git stash apply 1*. This will keep it in your *git stash* and it is useful if you want to apply the same changes in multiple branches. *Git stash apply n (in our case n === 1)* Conclusion We made it to the end! I hope this article was helpful, and that you were able to learn about, and be more comfortable with Git and GitHub. This article covered some of the basics of Git to try and help people starting out, or for those who might need a refresher....

Tips for Better Time Management as a Software Engineer cover image

Tips for Better Time Management as a Software Engineer

Tips for Better Time Management as a Software Engineer In today's ever-growing software landscape of tools and experience to gain, we can find ourselves lost wanting to do more, yet feeling like we don't have enough hours in the day to accomplish everything we want. This problem is all too common in every level of industry, and as software engineers we can find ourselves racing to finish multiple things yet never actually reaching the finish line with anything. If by chance we do, we're often burnt out and ready for vacation (sometimes after a few days). Sadly, we all can't be Elon Musk, but we can begin to fix our habits and patterns to feel more like a genius. Why Is Time Management Important? As professionals in any fields, it's important that we execute on our work in a consistent way that helps us not only feel *productive*, but also feel like we're helping achieve business goals as well as personal growth goals. Taking an example straight from my own life, I found myself mentally exhausted trying to keep up with everything in my life - my job, personal projects, and my life goals. It seemed like I had so much going on, but my fatal flaw was the fact that keeping myself busy with so much didn't make me feel accomplished. Something had to change. Benefits of Proper Time Management Simply put, there are no downsides to better time management. The act of time management is a great key to our success in whatever we do. While it's as simple as just doing it, focus and consistency are needed to really be successful. Because we live in a world where the speed of business and technology is increasing, being decisive about priorities is even more important. Where we fail is when we try to make snap decisions especially for important tasks that require our full attention. Not only does it take focus and consistency to succeed, but when a person knows what they're doing for the week, day, or hour, they can better focus on tasks and feel better about whatever they're doing. There's a sense of clarity that comes as a result of having a single focus on one thing and executing on it, even if it's not to completion. Helpful Tips for Better Time Management Important Being a master of your time can be a difficult task at first, but with some grit and determination, paving the road to success can become easier. Say you need to meet a deadline for a project with a release in a few days. How can we make our lives easier in a short period of time? 1. Redefine Goals and Expectations The first step is to write down all you tasks including goals, milestones, or whatever you use to describe large bodies of work. This will paint a clear picture of what is and what is *not* a priority. Wins from doing this include: - framing your to-dos to better execute them - freeing your mind from trying to remember why you're doing something - strategizing how to best execute tasks *Pro tip: adding goals and activities you're already currently working on to this list helps make sure nothing is missed.* This doesn't have to be a complicated step with each goal or task being general. In the next section, we'll see how to be effective with this list. 2. Prioritize Goals and Actionable Tasks Now we have a list of things to accomplish and activities already invested in, but we haven't figured out what to perform first. The best way we can prioritize these items is to place value on them. Value can be added to tasks by determing how much of an impact one task can make over the other. We can even timebox them to further increase that value. Ask youself these questions to categorize tasks: 1. Is it urgent and important? 2. Is it important, but not as urgent? 3. Is it urgent, but not important? 4. Is it neither urgent nor important? Remember urgency often has a time limit, and importance can be specific to you or to a group of persons. A couple of examples look like this: 1. Release candidate to deploy to production by 3/1/2021. Urgent because there's a due date, and important because it affects the team and/or business. 2. Technical task to unblock a portion of work. Doesn't have a time limit, but could help unblock yourself or another developer. 3. Make a Plan and Stick to It Lastly, and this may be the hardest part about time management: consistency is another one of those building blocks to success and it's absolutely critical that all of the effort so far does not crash down on us. This one really comes down to knowing how best you work. Whether it's waking up at 4:30 am to get your mind ready for the day or working out to keep your body active, figure out your motivation for the work being done and put it into your schedule. What you gain from doing this is: - a clear visualization of what's being worked on for the day or week - what's up next on your agenda - *when you'll have your breaks to recharge and finish strong* A note on breaks: developers write code, check processes, do code reviews, plan solutions to unique problems, suggest and articulate solutions, and the list goes on. Without scheduled breaks, we'd be on the fast track to burn out before the day's out. Make a plan solid by strategizing about the plan and how you'll *stick to it*. It makes a world of difference to set your work space away from your bedroom, or to work at the office or a coffee shop. Prepare healthy meals ahead of time so you're not skipping meals or eating junk. Workout during the week because your body is a temple, and the mind needs the body like the body needs a fully functioning mind. Tools to Help Structure Your Time As stated before, write things down and block out your time, so you know what you can and can't commit to. Here are a few tools that I use to get me through the day feeling well-accomplished: iCal - makes it easy to import multiple calendars, from one or more email addresses, into a single calendar view. Google Calendar - you won't get the same importing features as iCal, but their interface makes it easy to add shared calendars. If you can find a 3rd-party mail client that offers the same flexibility as iCal, I'd recommend that for the single calendar view. Notion - Notion has changed the way I operate entirely. You can use the free version personally and for work. It just requires that you use one email address per workspace. With Notion, you can: - Take general notes - Keep a work log - Generate to a table of tasks - Set reminders for tasks - Sort tasks into views - Use user-built templates. Some you can buy while others provide instructions on how to make them your own. If Notion isn't the right fit for you, Evernote is another really great tool for assembling thoughts into books, articles, and notes. It also features templates more than Notion does. Conclusion In the earlier example of a deadline for a release candidate, it may feel like there's no time left before that deadline rolls around. That sinking feeling like you're running out of time is the reason you should manage your expectations, priorities, and time. Only good things can come from taking back your time and focusing it. At the end of the day, you can look back and feel a sense of freedom. Be good to future you!...