Skip to content

Instantly share code, notes, and snippets.

View yesidlazaro's full-sized avatar
🏠
Working from home

Yesid yesidlazaro

🏠
Working from home
View GitHub Profile
/**
* Get a file path from a Uri. This will get the the path for Storage Access
* Framework Documents, as well as the _data field for the MediaStore and
* other file-based ContentProviders.
*
* @param uri The Uri to query.
* @author paulburke
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
fun getPath(context: Context, uri: Uri): String? {
@yesidlazaro
yesidlazaro / README.md
Created October 21, 2016 17:21
Fix OpenGApps permissions on CyanogenMod 13

Fix OpenGApps permissions on CyanogenMod 13

Updating to CyanogenMod 13 with OpenGApps is problematic and results in issues including repeated warnings such as

Unfortunately, setup wizard has stopped working

Or

Unfortunately, Google Play Services has stopped working

Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
---CONTRACT---
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public interface ${NAME}{
interface View extends BaseView {
}
interface Presenter extends BasePresenter<View> {
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/yesidlazaro/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
@yesidlazaro
yesidlazaro / colors.xml
Last active August 30, 2017 16:38
Alpha hex codes color
<!-- Alpha hex codes color in android
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
location /parse {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:1337/parse;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
}
sudo su
as root, rm /etc/init.d/pm2-init.sh
as root, run pm2 startup. it still complains that /etc/init.d/pm2-init.sh links already exists, despite just removing it
as root, pm2 start (my processes, eg ecosystem.json), pm2 start ecosystem.json
as root, pm2 save
reboot (if ubuntu)
@yesidlazaro
yesidlazaro / ExcellentAdventure.java
Created December 5, 2016 13:51 — forked from jonfhancock/ExcellentAdventure.java
This set of classes demonstrates what a Not Dumb ViewHolder should look like. It lightens the load on the Adapter, and places decisions about what to do with user interactions on the Activity where it belongs.
public class ExcellentAdventure {
@Retention(SOURCE)
@StringDef({ERA_BC, ERA_AD})
public @interface Era {
}
public static final String ERA_BC = "BC";
public static final String ERA_AD = "AD";
@yesidlazaro
yesidlazaro / MarginSpan.java
Created October 5, 2016 01:31 — forked from liberorignanese/MarginSpan.java
Android TextInputLayout with credit card mask
package com.liberorignanese.android.gist;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.style.ReplacementSpan;
/**
* Created by Libero Rignanese.
*/