Skip to content

Instantly share code, notes, and snippets.

View jmsalcido's full-sized avatar
🇲🇽
Sr Software Engineer - Remote

Jose Salcido jmsalcido

🇲🇽
Sr Software Engineer - Remote
View GitHub Profile
@jmsalcido
jmsalcido / build.gradle
Last active February 21, 2017 05:28
mavengradle
apply plugin: 'com.github.dcendents.android-maven'
def groupIdUsed = 'com.nearsoft.android' // Maven Group Id
group = groupIdUsed
install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
@jmsalcido
jmsalcido / build.gradle
Created February 21, 2017 05:11
bintraymavenplugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-beta3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
@jmsalcido
jmsalcido / build.gradle
Last active February 17, 2017 18:41
mas alla en android - jcenter mavenCentral - 2
allprojects {
repositories {
// repository 1 - jcenter / bintray
jcenter()
// repository 2 - mavenCentral
mavenCentral()
// repository 3 - custom
@jmsalcido
jmsalcido / snippet1.gradle
Last active February 17, 2017 18:35
mas alla en android - jcenter medium article
dependencies {
compile 'com.squareup.retrofit2:retrofit:2.1.0'
}
@jmsalcido
jmsalcido / imgcat.sh
Created December 6, 2016 07:11
imgcat, I dont remember where did I get this one, but I will upload it to my gists.
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST.
function print_osc() {
if [[ $TERM == screen* ]] ; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"
@jmsalcido
jmsalcido / androidMVP.java
Last active October 9, 2016 18:24
Android Architectura with MVP
// ----------------------------------------------------------
// VIEW
// ----------------------------------------------------------
// This class represents View layer and also Controller layer
// ----------------------------------------------------------
public interface MainView {
void showMessage(String message);
@jmsalcido
jmsalcido / androidMVC2.java
Last active October 9, 2016 17:35
Android Architecture UI 2
// ----------------------------------------------------------
// VIEW
// ----------------------------------------------------------
// This class represents View layer and also Controller layer
// ----------------------------------------------------------
public interface ActivityListener {
void showMessage(boolean buttonState, String message);
}
public class MainActivity extends AppCompatActivity implements ActivityListener {
@jmsalcido
jmsalcido / androidMVC1.java
Last active October 9, 2016 17:26
Android Architecture in UI 1 - very ugly code in Android.
// ----------------------------------------------------------
// VIEW & CONTROLLER
// ----------------------------------------------------------
// This class represents View layer and also Controller layer
// ----------------------------------------------------------
public interface ActivityListener {
void showMessage(boolean buttonState, String message);
}
@jmsalcido
jmsalcido / SharedPreferencesRepository.java
Created July 28, 2016 16:35
desarrolladores-android-pregunta-login
public class SharedPreferencesRepository {
private final Context context;
public SharedPreferencesRepository(Context context) {
this.context = context;
}
public boolean saveString(String key, String source) {
SharedPreferences.Editor editor = getSharedPreferences().edit();
@jmsalcido
jmsalcido / AndroidManifest.xml
Created July 15, 2016 17:28 — forked from danielgomezrico/AndroidManifest.xml
Android - AndroidJUnitRunner that disable animations, disable screen lock and wake processor all the time to avoid Tests to fail because of test device setup. Note that my test buildType is mock to have a manifest just for tests (dont want to ship an app with SET_ANIMATION_SCALE permissions...).
<?xml version="1.0" encoding="utf-8"?>
<!-- This file should be outside of release manifest (in this case app/src/mock/Manifest.xml -->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tests">
<!-- For espresso testing purposes, this is removed in live builds, but not in dev builds -->
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />