Skip to content

Instantly share code, notes, and snippets.

View alvareztech's full-sized avatar
:octocat:
Coding...

Daniel Alvarez alvareztech

:octocat:
Coding...
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using AGConnectAdmin;
using AGConnectAdmin.Messaging;
namespace ConsoleApp1
{
class Program
{
if (isAppInstalled("com.google.android.apps.maps")) {
// Normal process
} else {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/maps/dir/Current+Location/-17.760294,-63.201106"));
startActivity(myIntent);
}
@alvareztech
alvareztech / .java
Created October 9, 2020 13:42
Ask about the availability of Google Play Services.
public static boolean isGMSAvailable(Context context) {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
}
@alvareztech
alvareztech / Main.java
Created May 1, 2020 20:01
Prime Numbers with just a while in Java.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner e = new Scanner(System.in);
int n = e.nextInt();
int c = 1;
int p = 2;
int divisor = 2;
@alvareztech
alvareztech / .gradle
Last active August 16, 2019 04:35
Version bump gradle task
task bumperVersionPatch() {
group = 'bumper'
doLast {
def propertiesFile = file('gradle.properties')
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))
def versionName = properties['evaVersionName']
def versionCode = properties['evaVersionCode'].toInteger()
@alvareztech
alvareztech / .sh
Created July 26, 2019 16:01
AppCenter script
UPLOAD=$(curl \
-X POST --header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-API-Token: dbba7813bdefb700f087b37aa175921ad7171637' \
'https://api.appcenter.ms/v0.1/apps/bootcamp.mobile.jala-gmail.com/Eva-CE/release_uploads')
echo "Upload response: $UPLOAD"
UPLOAD_ID=$(echo $UPLOAD | jq --raw-output '.upload_id')
echo "Upload ID: $UPLOAD_ID"
UPLOAD_URL=$(echo $UPLOAD | jq --raw-output '.upload_url')
echo "Upload URL: $UPLOAD_URL"
@alvareztech
alvareztech / .sh
Last active July 25, 2019 04:25
AppCenter script: Uploading using the APIs
# https://docs.microsoft.com/en-us/appcenter/distribution/uploading
UPLOAD=$(curl \
-X POST --header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-API-Token: 123456789' 'https://api.appcenter.ms/v0.1/apps/a3dany/Android-Demo-CI/release_uploads')
echo "Upload response: $UPLOAD"
UPLOAD_ID=$(echo $UPLOAD | jq --raw-output '.upload_id')
UPLOAD_URL=$(echo $UPLOAD | jq --raw-output '.upload_url')
echo "Upload ID: $UPLOAD_ID"
echo "Upload URL: $UPLOAD_URL"
@alvareztech
alvareztech / .gitlab-ci.yml
Created July 11, 2019 05:08
GitLab CI: Android Basic Build and Deploy to HocketApp
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.0"
ANDROID_SDK_TOOLS: "4333796"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
@alvareztech
alvareztech / .gitlab-ci.yml
Created July 9, 2019 05:08
GitLab CI: Android Basic Build
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.0"
ANDROID_SDK_TOOLS: "4333796"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
Queue<Persona> cola = new PriorityQueue<Persona>(new Comparator<Persona>() {
@Override
public int compare(Persona o1, Persona o2) {
if (getValor(o1) > getValor(o2)) {
return -1;
}
if (getValor(o1) < getValor(o2)) {
return 1;
}
return 0;