Skip to content

Instantly share code, notes, and snippets.

@devqmr
devqmr / NFC_report_1603016965559.json
Last active October 18, 2020 10:29
Created via API 3 FROM SHOPPER Android
{ "DEM00000001":"true", "DEM00000001":"false", "DEM00000001":"false", "DEM00000001":"true", "DEM00000001":"false", "DEM00000001":"true", "DEM00000001":"false", "DEM00000044":"false", "DEM00000047":"false", "DEM00000071":"false", "DEM00000082":"true", "DEM00000085":"false", "DEM00000160":"true", "DEM00000163":"false", "DEM00000947":"false", "DEM00001568":"false", "DEM00001570":"false", "DEM00001934":"false", "DEM00001934":"false", "DEM00001934":"false", "DEM00001987":"false", "DEM00002035":"false", "DEM00002035":"true", "DEM00002247":"false", "DEM00002305":"false", "DEM00002451":"true", "DEM00002484":"false", "DEM00002489":"false", "DEM00002555":"false", "DEM00002600":"true", "DEM00002615":"false", "DEM00002623":"true", "DEM00002653":"true", "DEM00002663":"false", "DEM00002668":"false", "DEM00002707":"false", "DEM00002720":"true", "DEM00002767":"false", "DEM00002767":"false", "DEM00002997":"false", "DEM00003014":"true", "DEM00003127":"true", "DEM00003198":"false", "DEM00003268":"false", "DEM00003286":"false",
@devqmr
devqmr / MainActivity.kt
Last active July 27, 2020 15:07
Parcel FireStore GeoPoint
package android.example.com.firestore
import android.content.Intent
import android.os.Bundle
import android.os.Parcel
import android.os.Parcelable
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.GeoPoint
@devqmr
devqmr / YouTubeHelper.java
Created April 9, 2020 06:40 — forked from jvanderwee/YouTubeHelper.java
Extract video id from YouTube url in java
import com.google.inject.Singleton;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Singleton
public class YouTubeHelper {
final String youTubeUrlRegEx = "^(https?)?(://)?(www.)?(m.)?((youtube.com)|(youtu.be))/";
final String[] videoIdRegex = { "\\?vi?=([^&]*)","watch\\?.*v=([^&]*)", "(?:embed|vi?)/([^/?]*)", "^([A-Za-z0-9\\-]*)"};
@devqmr
devqmr / Create Gist from Android App
Last active September 2, 2023 16:02
Create Github Gist direct from mobile app
fun sendImageToGIST(fileName:String, content: String) {
val contentJSON = JSONObject()
contentJSON.put("content", content)
val fileJSON = JSONObject()
fileJSON.put("${fileName}_${System.currentTimeMillis()}.json", contentJSON)
val dataJsonObject = JSONObject()
dataJsonObject.put("description", "Created via API 3 FROM Android App")
dataJsonObject.put("public", true)
@devqmr
devqmr / kpi
Created December 9, 2019 10:40
{
"week": {
"items": 326.0,
"orders": 0.0
},
"total_score": {
"note": "Great! Keep Up!",
"color": "#007CF0",
"value": "98.54%",
"arrow_flag": 1.0
@devqmr
devqmr / ResourceProvider.kt
Created January 28, 2019 07:40
ResourceProvider helper class use make access to Android Resource without need to deal with context direct
package com.exa.nanashopper.util
import android.content.Context
import android.content.res.Configuration
import androidx.core.content.ContextCompat
import java.util.*
/**
* ResourceProvider helper class use make access to Android Resource without need to deal with context direct
* That will bw help inside ViewModel classes should not, though, hold a reference to Activities, Fragments, or Contexts
@devqmr
devqmr / LiveTemplate.xml
Created June 10, 2018 10:46
Live Template By Ahmed AbuQamar for Timber Log Library in both Java and Kotlin
<!-- Live Template By Ahmed AbuQamar -->
<template name="td" value="timber.log.Timber.d(&quot;$METHOD_NAME$: $content$&quot;);" description="Timber.d(String)" toReformat="true" toShortenFQNames="true">
<variable name="METHOD_NAME" expression="methodName()" defaultValue="" alwaysStopAt="false" />
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
@devqmr
devqmr / InternetConnectDetectReceiver.java
Created December 20, 2017 07:27
Detect the internet connect status, to determine when application has access to the internet and when not! * Remember to add InternetConnectDetectReceiver receiver to "AndroidManifest" class
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
@devqmr
devqmr / AppLifecycleTracker.java
Created December 17, 2017 15:50
How to detect when an Android app goes to the background and come back to the foreground
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.util.Log;
/**
* Created by Ahmed AbuQamar on 12/17/17.
*
*
@devqmr
devqmr / TypefaceTextView.java
Created April 22, 2017 11:20 — forked from twaddington/TypefaceTextView.java
An Android TextView with support for custom typefaces.
/*
* TypefaceTextView.java
* Simple
*
* Copyright 2012 Simple Finance Corporation (https://www.simple.com)
*
* 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
*