projects | blog

[all the things] [rss]

February 27, 2023 5:58 PM


I've heard that a lot of programmers sometimes get "in the zone". They're working on implementing something new, and they've got all these ideas in their brain and they're just pounding out lines and lines of code, and the hours just melt by. They don't want to get up. They just want to keep coding until they're done, even if it's past End-Of-Day.

I mentioned a few posts ago that I don't really get in the zone when I'm writing code. But I think the closest I ever get to feeling that way is when I'm done making all my code changes and I start making commits. Git commits.

I don't think I have strong opinions about too many things in the tech space, but I care a lot about commit messages. Every time there's a new dev on my team, and I review one of their PRs for the first time, I always point them to How to Write a Commit Message. I know I'm never going to get the hundreds of developers at the company to abide by these guidelines, but damnit I'm gonna try.

I rarely ever make a pull request with just one commit in it. I start with a gigantic diff, and I try to break it apart into smaller, easier to digest pieces. "Okay, first, I'll commit changes I made to the schema of this table, and then I'll make this change to the model layer, and then I'll work on the controller,..." When I make bug fixes, I start by adding a commit that adds a failing assertion, and I commit it by itself:

Exposes a bug in the code. This will fail as of this commit

The order matters too. If I made changes to five different files, what order do I want the reviewer to look at them in? I want to be able to guide the person, and not have them feeling overwhelmed because there are so many changes. I want them to know why I made certain choices in the code, and what parts of my change I feel unsure about.

The act of organizing everything helps me find places in my code that could be improved as well. Does this method need better documentation? Can I easily read this from top to bottom?

And I'll even throw in pointers for looking at a diff:

Look at this diff with the -w option, and you'll see that the only things I changed here were whitespace.

Use the --color-moved flag to see that I didn't add any new logic, just moved it from one spot to another.

And when I can't make something easy to digest, I'll say that too

This diff is kind of a mess, so I'd just recommend looking at the method in the file itself.

In the end, if I'm happy with everything, it feels like I've created something beautiful. At least to me.

Sometimes I wonder, is it really worth it for me to take an extra four hours just for committing? I know for a fact that some people I work with don't even read the commits. They just look at the full diff in bitbucket. And then I get a comment like this:

Why did you remove this line?

And in my head I'm thinking "Well if you read the commit message that went along with it, you'd know exactly why I removed it >.>"

But this scenario is slowly becoming less and less common.

A few weeks ago, everyone on my team was tasked to find an example of good documentation in the code. And one of my co-workers brought up my 30+ commit pull request, and said that even though it was large, it was very easy to follow. It was easy to see which parts of it were simple, and which other parts required a more thorough review. I think I spent a whole day putting those commits together, and it made me feel so good to know that it made a difference. For me, it was one of the most thoughtful comments I've ever gotten about my code.

May 17, 2021 6:19 PM

The food blog before the food blog

This is a set of 9 10 blog posts that I wrote in 2018, detailing the food the I made and ate over the course of 9 10 weeks. I had a very specific goal of having a $30 a week food budget, and I basically failed that because I always do :P I had considered just inserting these entries at the time that they were written, but I decided I wanted one long-ass blog post instead. With commentary!

Weekly Food Review 1: 8/10 - 8/17

Welp, one week in, and I've already failed to stay within my food budget. It really wasn't too bad considering I did stay under $30 in groceries, but I gave myself a special birthday treat and I was also obligated to get coffee at a programming meeting. (Girl Develop It! I miss those meetups)

Groceries: $29.08
Coffee: $2.94
Eating Out: $11.28
Total: $43.30

90% of the meals I make are from Budget Bytes (If you've never checked out this blog, you need to. It's amazing. I think it actually changed my life.) So this week I made three different dishes:

If you actually read through those recipes carefully, you'll notice that I stretched out the chicken skillet to 5 meals--one of the meals just didn't have much chicken, and I supplemented it with an egg. I actually still have one more meal of this left. I also really stretched out the salmon meal, but that's because I bought over a pound of salmon and a pound of green beans.

I don't know if it was because I ate way too much in the two weeks prior to this, but I was feeling really hungry a lot of the time. For next week, I'm going to plan four dishes and make the portions a little larger. I know, I still need to stay within my budget. Salmon was about a third of the grocery bill, so I think I can replace that with something cheaper and more filling. For this first week, I didn't actually think about how much each meal would cost, nor did I utilize much that was already in my kitchen or think about what foods were on sale.

My eating out meal was at a fancy restaurant because I had a $30 off birthday coupon! (Man I also miss birthday coupons) Of course I still ended up spending a lot on it because of tips. I've already committed to a meal out next week, but I'll actually try and see if I can keep my grocery bill under $20 for this next week.

May 16, 2021 12:26 PM

Ascii art

I first learned about ascii art back in the days of AIM when I would talk to SmarterChild. My middle school self thought that this chatbot was so cool. Obviously it was programmed to just talk to you, but it also had some other fun content like facts and games. It had a section filled with ascii art, and I spent one day just looking through every single piece of art it had.

After that, I went googling around to look for other ascii art, and I stumbled upon a really cute story which is something that I still consider one of my absolute favorite pages on the internet. Unfortunately it doesn't exist anymore, and it took me a while to even find that link. Thank goodness for the internet archive.

I was so inspired by "Fixed Width Days" that I wanted to create my own ascii art. I had created a site on GeoCities where I would put all the ascii art I typed up. Unfortunately, that doesn't exist anymore either, and it was taken down at a time in a my life where I guess I had other distractions, so I didn't save anything D: One of these days I'd like to present my own ascii art story.

_ _ .-~-. .-~-. ( `v' ) .-~-. .-~-. `-...-' `-...-' `. .' `-...-' `-...-' " Because I have to put some amount of ascii art in a post about ascii art

Until then, I'll keep making little pieces of ascii art here and there. I don't know anything about art, but there's just something I find so satisfying about using text to form pictures. I feel the same way about websites that look like they haven't been updated since the 90s. I've always wanted my own space on the internet that captured this feeling (while still somehow being mobile-friendly, because I guess that's important :P) and I think I've finally been able to do that with this personal site.

January 6, 2021 9:12 PM

Rubik's Cube

A few weeks ago, one of my coworkers told me he learned to solve a Rubik's Cube. I learned how to solve one in middle school, but I was never able to get really fast. One day, after I was kind of exhausted from work, I decided to pick mine up again to see if I remembered how to solve it.

I think it's like riding a bike.

.-'`'-. .-'`'-. .-'``'-., ,.-'``'-. .-'``'-., ,.-'``'-. .-' `'-., .-'` `'-., .-'``'-. .-' `'-., .-'` `'-., .-'``'-. ("=. ,.-'``'-., ,.-'``'-. ,.=") ("=. ,.-'``'-., ,.-'``'-. ,.=") | |"=., .-'` `'-., .="| | | |"=., .-'` `'-., .="| | | | |`"=.,.="`| | | | | |`"=.,.="`| | | |`-.,| | # | |,.-'| . |`-.,| | # | |,.-'| | |`-.,| # |,.-'| | -----|`. | |`-.,| # |,.-'| | | | |`-.,#,.-'| | | -----|,' | | |`-.,#,.-'| | | |`-.,| | # | |,.-'| " |`-.,| | # | |,.-'| | |`-.,| # |,.-'| | | |`-.,| # |,.-'| | ( | |`-.,#,.-'| | ) ( | |`-.,#,.-'| | ) '-. | | # | | .-' '-. | | # | | .-' `'-.,| # |,.-'` `'-.,| # |,.-'` `'-.#.-'` `'-.#.-'` Was this tedious to color? Absolutely. But it was a little better since I used my colorizer tool.

So, I suddenly decided on a new goal for the holidays. I would try to get a lot faster at solving the Rubik's cube. The method that I already knew is a layer by layer method that goes like this:

  1. Make a green cross
  2. Solve the first two layers
  3. Make a blue cross (2 possible algorithms, possibly performed twice)
  4. Orient the blue corners (1 algorithm, possibly performed twice)
  5. Get all blue on the top (2 algorithms, possibly performed twice)
  6. Fix the top edges (1 algorithm, possibly performed twice)

This beginner method works in a way such that you don't have to memorize too many algorithms. Some algorithms need to be performed multiple times to make this work, but it's easy to learn. I was able to solve the cube in just under 2 minutes this way. There are a lot of websites out there that teach this (though most go white -> yellow instead of green -> blue).

So, how was I going to get faster? Learn more algorithms and take less steps. When I was younger I wanted to learn the Fridrich method, but it was way too much for my 11 year old brain to handle. I would have to learn 53 algorithms. That still sounds like too much for my 28 year old brain to handle. But, I started with the most common algorithms and slowly started adding more to my brain.

I first had to go and learn all 13 last layer permutations. Except it's more than that because some of these you might have to perform backwards or flipped. There were actually 19 permutations that I needed to learn. But I just started with the most common ones and slowly added more to my memory. I also realized that this was a really good use for utilizing Anki flashcards. Once I got this down, I was able to completely remove step 4.

I also wanted to change step 5 from "possibly 2 actions" to "only ever 1 action". It was actually pretty common for this to require 2 separate actions. When I get to this step, I definitely have the blue cross. Looking at all the orientations, there were only 5 other patterns that have a cross on top. I don't know if it was because I had flexed my memory muscles with 19 algorithms already or because the orientation algorithms were just simpler, but adding 5 more patterns to my memory bank was actually really easy.

So at this point, I've shaved my Rubik's cube time down to about a minute. I think I've learned enough patterns to satisfy myself, and I'm just practicing it every day and logging my times in a spreadsheet to see if I can get faster.