Skip to content

Instantly share code, notes, and snippets.

View jerryOkafor's full-sized avatar

Jerry Hanks Okafor jerryOkafor

View GitHub Profile
@jerryOkafor
jerryOkafor / isisogram.py
Last active April 11, 2017 19:54
A function that check if a word is an Isogram, returns the boolean indicator and the turple of the word, raise a TyepError if the argument is not a string with a message "Argument should be a string", returns the argument and false if the argument is empty.
def is_iso(word):
if not type(word) is str:
raise TypeError("Argument should be a string")
if len(word) == 0:
return word, False
word = word.lower()
for char in word:
if word.count(char) > 1:
return tuple(word), False
return tuple(word), True
@jerryOkafor
jerryOkafor / shoppingcart.py
Created April 13, 2017 07:40
ShoppingCart.py with two methods to add and remove items and inheritance to for one of the Andela Home Study Exercise.
class ShoppingCart:
def __init__(self):
self.total = 0
self.items = {}
def add_item(self, item_name, quantity, price):
self.total += price * quantity
self.items.update({item_name: quantity})
def remove_item(self, item_name, quantity, price):
@jerryOkafor
jerryOkafor / layoutspec_ContactMessageViewSpec.java
Created May 30, 2017 22:57
Some Somaple Codes for Chat UI Using facebook Litho
package com.pacentltd.smartalumni.layoutspec;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.generic.RoundingParams;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;
import com.facebook.litho.Column;
@jerryOkafor
jerryOkafor / firesheetz.ts
Created December 12, 2017 16:19 — forked from CodingDoug/README.md
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
// Copyright 2017 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@jerryOkafor
jerryOkafor / proguard-rules.pro
Created February 18, 2018 19:11 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
/**
* Data class that is necessary for a UI to show a listing and interact w/ the rest of the system
*/
data class Listing<T>(
// the LiveData of paged lists for the UI to observe
val pagedList: LiveData<PagedList<T>>,
// represents the network request status to show to the user
val networkState: LiveData<NetworkState>,
// represents the refresh status to show to the user. Separate from networkState, this
// value is importantly only when refresh is requested.
package velasolutions.velabank.services
import android.accessibilityservice.AccessibilityService
import android.accessibilityservice.AccessibilityServiceInfo
import android.content.Context
import android.graphics.PixelFormat
import android.os.Build
import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
@jerryOkafor
jerryOkafor / Turnstile.kt
Created August 12, 2020 12:32 — forked from cdmunoz/Turnstile.kt
Turnstile hackerrank's problem solution
fun getTimes(times: Array<Int>, directions: Array<Int>): Array<Int> {
val result: Array<Int> = Array(times.size) { 0 }
val endTime: Int = times.max() ?: 0
if (endTime == 0) return result
val inQueue: Queue<Int> = LinkedList()
val outQueue: Queue<Int> = LinkedList()
var currentIndex = 0
var turnstile = 0
@jerryOkafor
jerryOkafor / tts.sh
Created November 17, 2020 19:37 — forked from andrius/tts.sh
Quick and dirty IVR sounds for your Asterisk PBX
#!/bin/bash
#title : tts.sh
#description : This script will convert text to speech using Google translate API
# and then to Asterisk formats (wav, sln, gsm)
#
#author : Andrius Kairiukstis <k@andrius.mobi>
#date : 26 July 2013
#version : 0.1
#usage : bash tts.sh FILENAME VOICE PHRASE