Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Yesid yesidlazaro

🏠
Working from home
View GitHub Profile
View gist:e7dee95333f93b8f2906d576e2199e84
/**
* 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? {
View Android Color Control Cheat Sheet
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:
-----------
View templates
---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> {
@yesidlazaro
yesidlazaro / colors.xml
Last active Aug 30, 2017
Alpha hex codes color
View colors.xml
<!-- Alpha hex codes color in android
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
View parse_nginx.json
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;
}
View forevernode.js
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 Dec 5, 2016 — 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.
View ExcellentAdventure.java
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 / README.md
Created Oct 21, 2016 — forked from jomo/README.md
Fix OpenGApps permissions on CyanogenMod 13
View README.md

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

@yesidlazaro
yesidlazaro / MarginSpan.java
Created Oct 5, 2016 — forked from liberorignanese/MarginSpan.java
Android TextInputLayout with credit card mask
View MarginSpan.java
package com.liberorignanese.android.gist;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.style.ReplacementSpan;
/**
* Created by Libero Rignanese.
*/
View SQLQueryBuilder.java
public class SQLQueryBuilder {
private static final String STATEMENT_SELECT = "SELECT";
private static final String STATEMENT_DISTINCT_SELECT = "SELECT DISTINCT";
private static final String STATEMENT_UPDATE = "UPDATE";
private static final String STATEMENT_INSERT_INTO = "INSERT INTO";
private static final String STATEMENT_DELETE = "DELETE FROM";
private static final String WHERE = "WHERE";
private static final String FROM = "FROM";
You can’t perform that action at this time.