Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Learning to code, as always!

Sri Harsha Chilakapati sriharshachilakapati

👨‍💻
Learning to code, as always!
View GitHub Profile
@sriharshachilakapati
sriharshachilakapati / TransformationUtils.kt
Created Nov 10, 2020
Transforms.map but with a default value
View TransformationUtils.kt
package com.goharsha.android.utils
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.Transformations
/**
* A utility to create a [LiveData] which will be giving out a [source] value manipulated with a
* [mapper] function. The difference between this function and [Transformations.map] is that this
* function additionally allows to set a [defaultValue] until the source starts producing.
@sriharshachilakapati
sriharshachilakapati / 3waysort.c
Created Feb 7, 2020
Sort 3 different arrays into 1 array
View 3waysort.c
#include <stdio.h>
#include <stdlib.h>
void merge_sort(int*, int*, int);
void merge2(int* dest, int* a, int* b, int lenA, int lenB) {
// Array indices
int dI = 0, aI = 0, bI = 0;
// Copy the values from all the arrays