Skip to content

Instantly share code, notes, and snippets.

View aliumujib's full-sized avatar

Abdul-Mujeeb Aliu aliumujib

  • Nigeria, Lagos
View GitHub Profile
@ryanbateman
ryanbateman / gist:5643826
Created May 24, 2013 14:17
Log out a Volley request as a curl command
private void logToCurlRequest(Request<?> request) {
StringBuilder builder = new StringBuilder();
builder.append("curl request: curl ");
builder.append("-X \"");
switch (request.getMethod()) {
case Method.POST:
builder.append("POST");
break;
case Method.GET:
builder.append("GET");
@gelitenight
gelitenight / Example.java
Last active November 8, 2023 08:42
A way to easily traverse any view hierarchy in Android
/* basic usage */
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
LayoutTraverser.build(new LayoutTraverser.Processor() {
@Override
public void process(View view) {
// do stuff with the view
}
}).traverse(root);
@archeg
archeg / gist:8333021
Created January 9, 2014 11:58
Example of code that uses HID for Android to connect to the device through USB.
package com.company.app.PlatformMethods;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@ph0b
ph0b / build.gradle
Last active February 12, 2023 07:45
sample build.gradle for generating split APKs per ABI
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101
@cesarferreira
cesarferreira / RxJava.md
Last active February 2, 2022 07:28
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@chranderson
chranderson / nvmCommands.js
Last active May 6, 2024 10:00
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@JosiasSena
JosiasSena / DeCryptor.java
Last active September 12, 2023 12:40
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@BenoitDuffez
BenoitDuffez / mig
Last active October 12, 2023 18:52
Parse migration failed exception (Android Room)
#!/bin/bash
# Clean up on exit
function finish {
rm -f expected found
}
trap finish EXIT
# How to parse JSON
JQ="jq --sort-keys"
@marnanel
marnanel / gist:87fee222990df53d23a9999d90a4eae2
Created June 27, 2018 18:39
Sub Station Alpha (libass) subtitle format spec
Sub Station Alpha v4.00+ Script Format
1. 1. General information
2. 2. The [sections] of a Sub Station Alpha script
3. 3. The line types in a Sub Station Alpha script
4. 4. Header lines, [Script Info] section
5. 5. Style lines, [v4 Styles] section
6. 6. Dialogue event lines, [Events] section
@bdivljak91
bdivljak91 / BluetoothStateBroadcastReceiver.txt
Last active April 23, 2021 05:43
Bluetooth state broadcast receiver - Clean Architecture
import android.bluetooth.BluetoothAdapter
import android.content.BroadcastReceiver
import android.content.Intent
import android.content.Context
import dagger.android.AndroidInjection
import io.reactivex.Observable
import io.reactivex.subjects.BehaviorSubject
import javax.inject.Inject