Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Daniel Alvarez alvareztech

🎯
Focusing
View GitHub Profile
View .cs
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using AGConnectAdmin;
using AGConnectAdmin.Messaging;
namespace ConsoleApp1
{
class Program
{
View .java
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 Oct 9, 2020
Ask about the availability of Google Play Services.
View .java
public static boolean isGMSAvailable(Context context) {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
}
@alvareztech
alvareztech / Main.java
Created May 1, 2020
Prime Numbers with just a while in Java.
View Main.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 Aug 16, 2019
Version bump gradle task
View .gradle
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 Jul 26, 2019
AppCenter script
View .sh
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 Jul 25, 2019
AppCenter script: Uploading using the APIs
View .sh
# 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 Jul 11, 2019
GitLab CI: Android Basic Build and Deploy to HocketApp
View .gitlab-ci.yml
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 Jul 9, 2019
GitLab CI: Android Basic Build
View .gitlab-ci.yml
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
View .java
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;