This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* From the given list of urls, returns a list of urls that were successfully downloaded by Glide | |
* and cached. | |
* | |
* @param imageUrls List of image urls. | |
* @return | |
*/ | |
suspend fun Activity.tryImageUrls(imageUrls: List<String>): List<String> { | |
return imageUrls.map { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirebaseUserIdTokenInterceptor implements Interceptor { | |
// Custom header for passing ID token in request. | |
private static final String X_FIREBASE_ID_TOKEN = "YOUR-CUSTOM-HEADER"; | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
Request request = chain.request(); | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntToAlphabet { | |
public static String toAlphabetic(int i) { | |
if (i < 0) { | |
return "-" + toAlphabetic(-i - 1); | |
} | |
int quot = i / 26; | |
int rem = i % 26; | |
char letter = (char) ((int) 'A' + rem); | |
if (quot == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedHashSet; | |
public class PowerSetUtil { | |
/** | |
* Returns the power set from the given set by using a binary counter | |
* Example: S = {a,b,c} | |
* P(S) = {[], [c], [b], [b, c], [a], [a, c], [a, b], [a, b, c]} | |
* @param set String[] | |
* @return LinkedHashSet | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source: Somewhere on StackOVerFlow I cant remember. | |
import java.io.UnsupportedEncodingException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
public class ShaUtil{ | |
public static String getHash( String toHash ) | |
{ | |
String hash = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
import java.util.concurrent.TimeoutException | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model.HttpMethods._ | |
import akka.http.scaladsl.model._ | |
import akka.http.scaladsl.model.ws._ | |
import akka.stream.ActorMaterializer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Janaka Jayasuriya, @pinkydoe | |
// Original By Jamie Chapman, @chappers57 | |
// License: open, do as you wish, just don't blame me if stuff breaks ;-) | |
package us.peripl.app.util; | |
import com.parse.ParseFile; | |
import com.parse.ParseGeoPoint; | |
import com.parse.ParseObject; |