Skip to content

Instantly share code, notes, and snippets.


Adi Andrea dekzitfz

View GitHub Profile
View paypal-webhooks.js
const express = require('express');
const bodyParser = require('body-parser');
const app = express().use(bodyParser.json());
var request = require('request');'/paypal-webhooks', (req, res) => {
var summary = req.body.summary;
var fee = req.body.resource.transaction_fee.value;
var id = req.body.resource.parent_payment;
dekzitfz / .gitlab-ci.yml
Created Jun 18, 2018
Gitlab CI for Firebase Test Lab
View .gitlab-ci.yml
image: jangrewe/gitlab-ci-android
- build
- test
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
dekzitfz /
Last active May 6, 2017
convert epoch to readable
public String getReadableTime(){
Date date = new Date(dt * 1000L);
DateFormat format = new SimpleDateFormat("MMM dd");
return format.format(date);
dekzitfz / strings.xml
Created May 6, 2017
format temperature
View strings.xml
<!-- Temperature format -->
<string name="format_temperature">
<xliff:g id="temp">%1.0f</xliff:g>\u00B0
public final class SunshineWeatherUtils {
private final static String TAG = SunshineWeatherUtils.class.getSimpleName();
public static String formatTemperature(Context context, double temperature) {
int temperatureFormatResourceId = R.string.format_temperature;
return String.format(context.getString(temperatureFormatResourceId), temperature);
public static int getSmallArtResourceIdForWeatherCondition(int weatherId) {
dekzitfz /
Last active Aug 20, 2016 — forked from kristopherjohnson/
Android: Check whether Google Play Services are installed and current
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
} else {
Log.i(TAG, "This device is not supported.");
dekzitfz /
Created Aug 1, 2016
Detect incoming sms in android
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.provider.Telephony;
import android.telephony.SmsMessage;
import android.util.Log;
dekzitfz /
Created Aug 1, 2016
check if an android service is running or not
private boolean isMyServiceRunning(Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
return false;
You can’t perform that action at this time.