• 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

Justin

Writing CSVs in Python

Posted Feb 13, 2023 — Updated Jan 10, 2024

To write CSVs in Python, you’ll want the builtin csv module. More specifically, I usually use csv.DictWriter. Python DictWriter Python’s csv module has both a writer and a DictWriter class, but I’m virtually always working with dictionaries, so I always use DictWriter. It’s pretty straightforward. You grab your data, open a file in a context […]

Filed Under: Python

Python “is” operator vs double equals “==”

Posted Feb 11, 2023 — Updated Jan 10, 2024

Python’s is operator compares object identity, while == compares object values. Python “is” operator In Python, is compares identity. In other words, it checks if two objects are the same object. It does not care if they have equal values, it cares if they have the same id in memory. This is why you often […]

Filed Under: Python

How to free up disk space

Posted Feb 8, 2023 — Updated Jan 10, 2024

Part of being a developer means constantly downloading new packages, updates, codebases, etc. Eventually, your computer starts to fill up. This post details how to clean it out. The du command This is the disk usage command, and it is key to figuring out what is using your space. Here’s my usual workflow: Starting at […]

Filed Under: Command Line, Tips

Using a custom domain for github pages

Posted Feb 8, 2023 — Updated Jan 10, 2024

Custom domains make your projects feel more legit, and they’re pretty easy to set up. This post will walk you through setting up a custom domain for github pages, but it assumes you have a few things already:  With those assumptions in place, let’s set up a custom domain! As an example, here’s a project […]

Filed Under: Tutorials

Find elements in a ruby array

Posted Feb 2, 2023 — Updated Jan 10, 2024

There are several ways to do this, and their outputs differ based on your needs Let’s do a couple of examples. Array.include? Simple: Array.index This method is a bit confusingly named. It gives you the first index at which the given element appears, not the element at the index given. Array.find and Array.detect Two names […]

Filed Under: Arrays, Ruby

Insert into javascript array at a specific index

Posted Feb 1, 2023 — Updated Jan 10, 2024

There are two options when inserting into an array in javascript: slice() and splice(). Array.prototype.slice Array.prototype.slice returns a copy of a portion of an array, like so: Let’s say we want to insert c where it belongs in this list, between b and d. The three dots … in the above example are known as javascript spread syntax, […]

Filed Under: Arrays, Javascript

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

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Go to Next Page »

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