Check if Two Strings Are One Edit Away

Question You can edit a string in three different ways: insert, remove or replace a character. Write a function to see if two strings are one or zero edits away. Example like, like --> true (zero edits) like, likes --> true (one edit: remove/insert) like, life --> true (one edit, replace) like, lik --> true (one edit: remove/insert) like, pine --> false (two edits) like, lion --> false (two edits) Strategy For most questions that require you to return true or false, you can reduce the scope of the question by removing noise....

June 15, 2022 · 3 min

Swift Strings for iOS interviewing

This is bit of fast paced intro into Swift Strings. ASCII, Unicode and the challenges they introduce. ASCII Ages ago, only characters that existed were just a to z, A to Z, and bunch of other English characters. This was problematic. You were limited to only 7 bits i.e. only 2 ^ 7 - 1 = 127 characters. Also non-English characters where not part of ASCII. Literally the name says ‘American Standard Code for Information Interchange’....

June 12, 2022 · 6 min

How to Prepare Yourself as a Podcast Guest?

The first time I listened to an iOS podcast was yrs ago. I was struggling to grasp basic iOS concepts and podcasts weren’t really covering basic technical material. It just didn’t seem like the right way of learning about things. Two weeks ago I got invited to Side Project Spotlight Podcast. I was thrilled but also clueless. Had to do some googling, listen to a few episodes and purchase some equipment....

May 12, 2022 · 6 min
self-contained rv

What is a Self Contained Build Script?

So I had this need to add a brew package named gh into our build script. I spoke with with the team that handled our agents and asked them to add a new package on the agents. I was told that the package has to be included as part of the build script and that build scripts need to be self-contained. At first I didn’t fully understand what ‘self-contained’ means in this context but as I digged more into our Jenkinsfile I learned what it meant....

April 22, 2022 · 4 min
dispose bag

CurrentValueSubject Example

I googled a bit for “CurrentValueSubject Example”. Surprisingly I wasn’t able to find a simple answer. So I created a few examples: Basic import UIKit import Combine class ViewController: UIViewController { var name = CurrentValueSubject<String, Never>("Jason") override func viewDidLoad() { super.viewDidLoad() setup() } func setup() { let _ = name.sink { value in print(value) // Jason, Jason Bourne } name.send("Jason Bourne") } } Basically every time you call send on a publisher, the subscriber gets a callback....

April 14, 2022 · 7 min
git cherry-pick

How to cherry-pick a library fix?

I’ve done this so many times, but every time I do it with hesitance. It’s usually because I’m not certain I’m finding the right commit or if I’m applying it the right way. These steps explain the process and how to validate that you’re doing thins the right way. Find out the library version that your release is using. Check out that version of your library. Create a new branch off that version....

April 5, 2022 · 2 min

Whats the Difference Between Unowned and Weak References?

TIL I finally learned when to use unowned as opposed to using weak. Differences Under the hood: unowned is essentially a force-unwrap of a weak capture, with all that it entails. Because of this using it slightly more dangerous. Crash danger: Accessing an unowned reference while it’s nil will cause a crash. Compilation error: Every weak reference, must be an optional property. Otherwise you’ll get a compilation error: weak var delegate: DataEntryDelegate = DataHandler() // ERROR: 'weak' variable should have optional type 'DataEntryDelegate?...

March 11, 2022 · 3 min

How (Fidelity) Stocks Work?

I know this blog is mainly an engineering blog, but this is something I struggled to learn and thought blogging my findings would be helpful for my friends who want to learn about their investments or evaluate and compare offers. The following are a result of my findings after an hour long phone call with Fidelity representative. I opened the chat section in my browser and asked to speak with someone....

March 2, 2022 · 8 min

UIApplication BackgroundTasks Through The Lens of Closures

The sync closure func processTwoNumbers(_ num1: Int, _ num2: Int, handler: (Int, Int) -> ()) { handler(num1, num2) } processTwoNumbers(10, 22, handler: { num1, num2 in print(num1 + num2) }) In the above, the handler is called in a sync matter. Same as below (1...100).forEach { val in print(val) } print(101) Uniqueness: The block passed in is executed immediately at the call site. The async closure — block isn’t stored. enum Result { case success(Data?...

February 22, 2022 · 5 min
git branch synopsis

How to Read Git Documentation

I used to find it super hard to read git syntax. I didn’t know what what --, <>, [], ..., |, (), etc meant. Turns out, it’s a whole lot easier than you think. The synopsis contains a list of most likely forms you’d try. But sometimes the synopsis is just one big long synopsis where all the options are thrown in at once. This can make it hard to understand the different ways of using the options and commands....

February 11, 2022 · 6 min