Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Adi Andrea dekzitfz

🎯
Focusing
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');
app.post('/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
dekzitfz / .gitlab-ci.yml
Created Jun 18, 2018
Gitlab CI for Firebase Test Lab
View .gitlab-ci.yml
image: jangrewe/gitlab-ci-android
stages:
- build
- test
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
@dekzitfz
dekzitfz / GetReadable.java
Last active May 6, 2017
convert epoch to readable
View GetReadable.java
public String getReadableTime(){
Date date = new Date(dt * 1000L);
DateFormat format = new SimpleDateFormat("MMM dd");
return format.format(date);
}
@dekzitfz
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
</string>
View SunshineWeatherUtils.java
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
dekzitfz / checkGooglePlayServicesAvailable.java
Last active Aug 20, 2016 — forked from kristopherjohnson/checkGooglePlayServicesAvailable.java
Android: Check whether Google Play Services are installed and current
View checkGooglePlayServicesAvailable.java
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)
.show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
@dekzitfz
dekzitfz / AndroidSMSListener.java
Created Aug 1, 2016
Detect incoming sms in android
View AndroidSMSListener.java
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
dekzitfz / AndroidServiceStatus.java
Created Aug 1, 2016
check if an android service is running or not
View AndroidServiceStatus.java
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.