Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cutiko's full-sized avatar

Erick Navarro cutiko

View GitHub Profile
@cutiko
cutiko / RestartAppAdb.md
Created July 3, 2019 17:23
Restart Android App using ADB

Remember to replace com.domain.appname with your actual app package name

adb shell am force-stop com.domain.appname
adb shell am start -n com.domain.appname/com.domain.appname.MainActivity
@cutiko
cutiko / infinity.kt
Created June 6, 2019 15:02
Inifinity is a double
fun main(args: Array<String>) {
System.out.println("Lets buy beer")
buyBeer(1.0)
buyBeer(2.0)
buyBeer("Infinity".toDouble())
}
fun buyBeer(beer : Double) = System.out.println("You are buying $beer beers and is more than one beer ${beer > 1}")
@cutiko
cutiko / index.js
Created May 2, 2019 17:39
Functions custom claims example
exports.userCreationListener = functions.auth.user().onCreate(user => {
const admins = {
"first@admin.com": true
};
const email = user.email;
if (!admins[email]) {
return false;
}
const uid = user.uid;
return admin.auth().setCustomUserClaims(uid, {superAdmin: true}).then(
@cutiko
cutiko / Timezones.md
Last active March 15, 2019 13:57
All the TimeZone IDS
@cutiko
cutiko / AvailableBox.java
Last active February 6, 2019 19:30
How to create forms
public class AvailableBox extends Checkbox implements FormField, OnCheckChangeListener {
private ErrorCallback errorCallback;
private User user;
//use the constructor with 1 argument for using only on java and the constructor with 2 arguments for using on xml
public AvailableBox(...) {
//you can add any MUST HAVE behaviour in the constructor
setOnCheckChangedListener(this);
}
@cutiko
cutiko / README.md
Last active February 1, 2019 20:07
Simple script for spelling correction from a file

This scripts use LanguageTool for english spelling you can change it if you want to

This scripts also use Pando please make sure installing it before continue

  1. Copy the script to your bin directory, on mine is called spelling
  2. sudo chmod 755 FILENAME
  3. Use it :)
@cutiko
cutiko / Readme.md
Last active January 30, 2019 18:07
Interactive commit with text prompt for bash

This project has moved to a Github repo

igit repo

icommit

Simple command for an interactive commit with an input prompt in the bash terminal

icommit demo gif

  1. open terminal
@cutiko
cutiko / regexCheatsheet.js
Created January 10, 2019 21:55 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@cutiko
cutiko / GetRtdData.java
Last active December 19, 2018 18:48
How to test Firebase
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class GetRtdData<Model> extends implements RtdDataContract<Model> {
private final Class<Model> modelClass;
public GetRtdData(Class<Model> modelClass) {
this.modelClass = modelClass;
}
@Override
@cutiko
cutiko / GeoExecutor.java
Created December 12, 2018 16:05
ThreadPoolExecutor java example
import android.os.Process;
import android.util.Log;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Created by cutiko on 30-11-17.