Snippets

Quick bits and pieces that could save you a lifetime!

Easy Peasy Merge Sort in Kotlin

January 23, 2019

Merge Sort is an efficient, comparison oriented, general-use sorting algorithm. In many different interview scenarios, you will be asked to code some sort of sorting algorithm, here we will…

Programmatically click on an element in Javascript

January 23, 2019

In many situations you need to simulate a click on an element. Many times this is useful in testing, where you'd need to simulate a click and test the consequences of the action. How to do it in…

Programmatically set device volume using MPVolumeView (iOS Swift)

January 22, 2019

Often times in an application you want to be able to allow the user to change the output volume of the app. There is no easy way to achieve this so we need to use a workaround by leveraging the…

How to rename a local Git branch

January 22, 2019

People change their minds about branch names all the time. Thankfully git allows quick and easy renaming of branches. Here are a few ways to rename a local Git branch. If currently on the branch: If…

How to display an Alert Popup in iOS Swift

January 21, 2019

Often times in an iOS application you will need to prompt the user with an alert to either display something or have the user perform an action (ie Confirm action). has a built in alert called and…

How to redirect to another page in Javascript

January 21, 2019

This question often comes up, and people are usually wondering whether jQuery is needed for redirecting to a different page. The answer is no. Compatible with most browsers including IE9 & higher…

Raw Values vs Associated Values in Swift

January 20, 2019

Raw values are used to associate constant (literal) values to enum cases. The value type is part of the enum type, and each enum case must specify a unique raw value (duplicate values are not allowed…

Search by