Snippets

Quick bits and pieces that could save you a lifetime!

Leveraging Null Safety in Kotlin

January 17, 2019

One of the biggest annoyance in Java is always having to deal with . Looking at any large Java code base, you are bound to see the the…

Flattening Arrays in Javascript Recursively

January 16, 2019

In many cases when processing data you would need to flatten the final result, specially when using promises and resolving multiple pieces…

Simplify assigning properties with Apply in Kotlin

January 15, 2019

Kotlin has this nice apply function that is an extension that allows you to set multiple properties at one time. It returns itself after…

Understanding Ranges in Kotlin

January 14, 2019

Often times we need to create a loop, however in many different languages to define a range varies. In Kotlin, there are few ways we can…

Shuffling an Array in Javascript

January 14, 2019

There are many ways to shuffle an arrays. Various algorithms offer different levels of performance, and specially bias! Here's a quick…

How to find the Difference between two arrays in Swift

January 14, 2019

In situation where you would like all the elements that are in one array but not the other (ie in one array but not both) - a solution is to…

AuthGuards in React

January 12, 2019

What is an AuthGuard? An AuthGuard in Angular is there to make sure that certain conditions are met for your route to render, and if not…

Javascript ES6 Generator Functions

January 12, 2019

Inspired by Python, here to stay for the best! "Functions that can be exited and re-entered" Generator functions are great in the sense that…

Easily implement Quick Sort using Swift Filter

January 12, 2019

Quicksort is one of the most famous algorithms in history. It was invented way back in 1959 by Tony Hoare, at a time when recursion was…

Convert JSON to Swift Objects

January 11, 2019

Parsing JSON in swift has always been a nightmare having to deal with Dictionaries and pulling keys from that dictionary. Swift 4+ makes it…

Map, filter & reduce in Javascript

January 11, 2019

Functional programming focuses heavily on lists and list operations. Within these operations 3 functions are very popular and re-used in…

How to deserialize JSON using GSON (Java)

January 11, 2019

GSON helps deserializing JSON objects easily to POJO. Install Java to JSON JSON to Java Sample JSON Create Model Deserialize

Chaining Promises in Javascript

January 09, 2019

We all know about the callback-hell phenomena in Javascript. Usually in backend processes we are retrieving and comparing data from…

Undo git changes using the command line

January 08, 2019

Sometimes we have extra lines of code for testing that we don't want to commit and when we are done we should undo all the changes without…

VSCode - Insert a New Line at the End of Files Automagically

January 08, 2019

It's not about adding an extra newline at the end of a file, it's about not removing the newline that should be there. A text file, under…

Fixing Webpack Error "Cannot find module WebpackOptions.json"

January 08, 2019

Using a tool with as many moving parts as webpack can come with its own headaches; mismatched versions of loaders, missing configurations…

Manual install APK to Android Emulator for faster builds.

January 08, 2019

Sometimes Android Studio can add a lot of overhead and you may want an easy way to generate an app's APK via the command line. Maybe you're…

Customize Storybook Using the Options Addon

January 07, 2019

Storybook is a great way to showcase your web components, and comes with many useful add-ons, among which is the options add-on which is a…

Easily make REST calls in Android using Retrofit

January 07, 2019

For those who are new to Android Development, the first major complication is making a network call. If you look at the Android Developer…

Send SMS Messages using Twilio's API in Javascript

January 06, 2019

Twilio is a popular platform for sending & receiving SMS/MMS messages. Twilio's easy to use APIs make on-demand messaging real fun! Before…

Save disk space by deleting Xcode Derived Data

January 05, 2019

Xcode uses derived data to make builds faster. Overtime this could take up significant space on your hard drive. Open terminal and paste in…

Classes in Vanilla Javascript

January 05, 2019

Constructor: Class Methods: Test the class:

Group arrays by a criterion with Swift 4.0

January 04, 2019

Let's say you have an array, and you wanted to group each item in an array that have a common value. Swift 4.0 has a powerful grouping by…

Convert querySelectorAll NodeList to Array

January 03, 2019

There are multiple ways to make a iterable: Most browser-compatible method: Array.from alternative (not compatible with IE): ES6 Method:

Simple iOS Network Call using Moya

January 03, 2019

Install Setup Lift off!

Easy HTTP Calls Using Axios

January 03, 2019

Run: GET Request: POST Request: More Examples on the Axios repo

Run DDL Files in DB2

January 02, 2019

Before running this command, exit the DB2 shell: The output to the commands will be stored inside of the file .

Removing all tables in DB2

January 01, 2019