• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Justin Joyce

Practical tips and tutorials about software development.

  • Standing Invitation
  • Featured Posts
  • Latest
  • About

Archives for January 2023

Calculate Date Difference in Python

Posted Jan 28, 2023 — Updated Jan 10, 2024

Getting the difference between two dates or datetime objects in python is delightfully straightforward; you can just subtract them! For date objects The subtraction returns an object of class timedelta, which has a few handy properties like .seconds and .days. If using whole date objects however, only the .days property will matter. Since there’s no […]

Filed Under: Dates, Python

Git commit amend

Posted Jan 24, 2023 — Updated Jan 10, 2024

Maybe there’s a typo in your most recent commit message, or maybe you forgot to add a file. Git commit –amend allows you to go back and modify your commit—no one has to know you made a mistake. Amend a previous commit message Here’s a quick example fixing a typo in a message: Amend the […]

Filed Under: Git

Check if a key exists in a Golang map

Posted Jan 21, 2023 — Updated Jan 10, 2024

Use an “index expression“. Buried in that official doc link is an example like this: In other languages, using index expressions (a term I just learned) could be risky if the key doesn’t exist: Instead of blowing up, or returning a generic (and possibly dangerous) value, Go gives back a second piece of information letting […]

Filed Under: Golang

Command line manual pages and tldr

Posted Jan 20, 2023 — Updated Jan 10, 2024

When looking into command line … commands, you’ve probably seen the man command, which is short for manual. For instance, if I want to know all about the ls command I can run man ls, which returns this on my mac: That’s a lot of info, and the screenshot above just the tip of the […]

Filed Under: Command Line, Tips, Tools

Calculate Date Difference in Javascript

Posted Jan 19, 2023 — Updated Jan 10, 2024

You have two main options: Let’s go through a quick example of each approach. Using date-fns to get date difference Above, I mentioned luxon, day.js, and date-fns. They’re all great packages, but I personally prefer date-fns due to its easily searchable documentation. date-fns has a ton of other functionality and the docs are very good […]

Filed Under: Dates, Javascript

How to find files on linux / mac

Posted Jan 19, 2023 — Updated Jan 10, 2024

Command line find is a powerful, underutilized tool. In this post, I’ll go through the following use cases: Find files by name I use this all the time. Let’s say I’m in my ~/Downloads directory. That directory has several hundred files in it—and quite a few subdirectories—so it’s a bit hard to comb through in […]

Filed Under: Command Line, Productivity

Primary Sidebar

Recent Posts

  • Every Built-In Vim Color Scheme (with screenshots)
  • Reverse a string in Python
  • Meeting Cost Calculator
  • Vim find and replace
  • What makes an effective development team

Categories

  • Arrays (5)
  • Command Line (9)
  • Dates (3)
  • Featured (7)
  • Git (7)
  • Golang (5)
  • Javascript (8)
  • Productivity (8)
  • Projects (4)
  • Python (15)
  • Regex (2)
  • Ruby (3)
  • Shell (2)
  • Thoughts (2)
  • Tips (11)
  • Tools (3)
  • Tutorials (1)
  • Vim (4)

Archives

  • July 2024 (1)
  • February 2024 (1)
  • January 2024 (1)
  • December 2023 (1)
  • November 2023 (1)
  • October 2023 (4)
  • September 2023 (1)
  • August 2023 (2)
  • July 2023 (5)
  • June 2023 (3)
  • May 2023 (6)
  • April 2023 (5)
  • March 2023 (5)
  • February 2023 (10)
  • January 2023 (6)
  • December 2022 (7)

Copyright © 2025 · Contact me at justin [at] {this domain}

  • Privacy Policy