Skip to content

Instantly share code, notes, and snippets.


Afzal Najam AfzalivE

View GitHub Profile
View ForegroundServiceLauncher.kt
class ForegroundServiceLauncher(private val serviceClass: Class<out Service>) {
private var isStarting = false
private var shouldStop = false
private var isCreated = false
fun startService(context: Context, block: Intent.() -> Unit = {}) {
if (!isCreated) {
isStarting = true
AfzalivE /
Created Oct 29, 2020 — forked from benigumocom/
Connect Wireless Debug from Terminal on Android11
#!/usr/bin/env python3
Pair and connect devices for wireless debug on terminal
python-zeroconf: A pure python implementation of multicast DNS service discovery
AfzalivE / quotes.json
Last active Dec 15, 2016 — forked from signed0/quotes.json
json formatted quotes
View quotes.json
"quote": "Life isn’t about getting and having, it’s about giving and being.",
"author": "Kevin Kruse"
"quote": "Whatever the mind of man can conceive and believe, it can achieve.",
"author": "Napoleon Hill"
View Android CI
#Android and CI and Gradle (A How-To)
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br>
The Android platform is not one of them.
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming.
But fear not! It can be done!
Before we embark on our journey, you'll need a few things to run locally:
AfzalivE / idea
Last active Jan 15, 2020 — forked from chrisdarroch/idea
Open/Import a gradle or idea project in Android Studio from your command line!
View idea
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/Android\ | tail -n1`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
View gist:8ae077720a3a1e3e9ac6
* A module for dependencies which require a {@link android.content.Context} or
* {@link} to create.
library = true
public class ContextModule {
private Context appContext;
AfzalivE / gist:eea5918ac0c61eb08343
Last active Aug 29, 2015 — forked from ljubisa987/gist:e33cd5597da07172c55d
TextInputLayout with fixed "hints not showing"
View gist:eea5918ac0c61eb08343
package com.centralway.numbrs.numbrsapp.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
AfzalivE / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
AfzalivE / gist:e26d4b10efdd7239031e
Created May 23, 2014 — forked from anonymous/gist:11010752
Inspiration for openGL stuff
View gist:e26d4b10efdd7239031e
void setup(){
float f(int i, int j, float q){