Skip to content

Instantly share code, notes, and snippets.

View biodunalfet's full-sized avatar

Hamza Fetuga biodunalfet

View GitHub Profile
@biodunalfet
biodunalfet / MultipleViewholders.kt
Last active January 5, 2019 16:38
Fastadapter quick samples
package com.hf.ussdone.data
import android.annotation.SuppressLint
import android.support.v4.content.ContextCompat
import android.view.View
import com.hf.ussdone.R
import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.items.AbstractItem
import kotlinx.android.synthetic.main.base_cat_list_item.view.*
import kotlinx.android.synthetic.main.fave_cat_item.view.*
@biodunalfet
biodunalfet / Interceptor.java
Created January 15, 2019 06:26 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@biodunalfet
biodunalfet / Interceptor.java
Created January 15, 2019 06:26 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON

Privacy Policy

Hamza Fetuga built the UssdOne app as an Ad Supported app. This SERVICE is provided by Hamza Fetuga at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at UssdOne unless otherwise defined in this Privacy Policy.

private class MyBrowser extends WebViewClient {
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@TargetApi(Build.VERSION_CODES.N)
@Override
@biodunalfet
biodunalfet / barter_t_and_c.md
Last active October 7, 2020 15:11
Barter Terms and Conditions

Flutterwave's Barter® Terms of Service

Introduction

These Terms and Conditions ("Terms") contained herein on this page is a legal agreement between you, as a prospective customer and or customer of Flutterwave's services and Flutterwave UK Limited (Flutterwave, "we", "our" or "us") and shall govern your access to and use of Flutterwave's services which include all pages within the Flutterwave website, mobile applications and other products and services (collectively referred to

suspend fun <ResponseType>
makeCall(deferredResponse: Deferred<Response<ResponseType>>): LiveData<Resource<ResponseType>> {
val result = MutableLiveData<Resource<ResponseType>>()
try {
val response = deferredResponse.await()
if (response.isSuccessful) {
fun price(items : String) : Double {
//split string into items
//store in a map thats maps items to their quantity
//calculate price
val itemsAsList = items.toCharArray().map { it.toString() }
val itemsMap = mutableMapOf<String, Int>()
for (i in itemsAsList) {
val qty = itemsMap.getOrDefault(i, 0)
// https://www.codewars.com/kata/568e111353952f6c82000014
fun main(args: Array<String>) {
// print(Character.getNumericValue('5'))
print(UPC("614141000030"))
}
fun UPC(s : String) : Boolean {
//calculate the odd sum
@biodunalfet
biodunalfet / test_spec.java
Created July 24, 2019 11:11
Specification for unit test
package com.flutterwave.raveandroid.validators;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;