Skip to content

Instantly share code, notes, and snippets.

View devmike01's full-sized avatar
:octocat:
Focusing

Gbenga devmike01

:octocat:
Focusing
View GitHub Profile
@devmike01
devmike01 / PartClickTextView.java
Created May 23, 2018 20:10
This code snippet makes part of a string clickable.
public class PartClickTextView extends TextView{
public static final String TAG = PartClickTextView.class.getSimpleName();
private OnPartTextClickListener mListener;
public interface OnPartTextClickListener{
void onPartTextClick(View view);
}
public void setOnPartTextClickListener(OnPartTextClickListener mCallback){
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain()
@devmike01
devmike01 / TimeOutService.java
Created October 16, 2019 15:20
A service that handles app timeout
package devmike.leviapps.co.tensorlitepose.device;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.os.SystemClock;
@devmike01
devmike01 / omni_state.dart
Last active October 31, 2020 14:09
Some code snippet to handle your messy API call states. ;) #EndSARS
class ApiState<T> {
String message;
T data;
ApiStates state;
ApiState(this.state, this.data, this.message);
static ApiState<T> loading<T>() {
return ApiState<T>(ApiStates.Loading, null, null);
}
@devmike01
devmike01 / RecursionReverseString.java
Last active June 16, 2022 21:03
A simple java code snippet which uses recursion to reverse any given string.
public class RecursionReverseString {
public static void main(String[] args){
String value = "abcdefghijk";
System.out.println(reverse(value.length()-1, value, ""));
}
public static String reverse(int l, String value, String r){
if(l <0 ){
return r;
@devmike01
devmike01 / binary_to_decimal.py
Last active February 10, 2023 13:47
A simple script which converts decimal number to 8 bit binary code
"""
To run:
- Download this code as .py
- Install python3 on your machine
- Open your CMD(Windows) or Terminal in Linux/MacOS and use the following command
python3 /Path/to/binary_to_decimal.py [COMMAND] [DECIMAL_NUMBER]
- COMMANDS
* -b : To convert decimal to binary
* -d : To convert binary to decimal