Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Roberto Carlos Gonzalez Flores rcgonzalezf

🎯
Focusing
View GitHub Profile
View Genymotion with Charles Proxy.md

Charles Proxy in your Genymotion Android emulator

  1. Settings -> Wifi -> Press and hold your active network
  2. Select “Modify Network”Select “Show Advanced Options”
  3. Select “Proxy Settings -> Manual”
  4. Set your Proxy to: 10.0.3.2 (Genymotion’s special code for the local workstation)
  5. Set your Port to: 8888
  6. Press Save
View NavigateBack.kt
package lavanderia.org.lavanderia
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.NavUtils
import android.support.v4.app.TaskStackBuilder
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
@rcgonzalezf
rcgonzalezf / FuelOkHttpClientForHttpPatch.kt
Created Feb 7, 2018
FuelOkHttpClientForHttpPatch sample using OkHttpClient
View FuelOkHttpClientForHttpPatch.kt
package com.rcgonzalezf.example.common.network
import com.github.kittinunf.fuel.core.Client
import com.github.kittinunf.fuel.core.FuelError
import com.github.kittinunf.fuel.core.Request
import com.github.kittinunf.fuel.core.Response
import okhttp3.MediaType
import okhttp3.OkHttpClient
import okhttp3.RequestBody
import java.io.ByteArrayInputStream
@rcgonzalezf
rcgonzalezf / ExampleFragment.kt
Last active Mar 10, 2020
Fragment new Instance in Kotlin
View ExampleFragment.kt
package org.rcgonzalezf.kotlin
import android.os.Bundle
import android.support.v4.app.Fragment
class ExampleFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// More logic here
@rcgonzalezf
rcgonzalezf / Problem2.kt
Created Aug 11, 2017
Trying to achieve pure functions with Kotlin.
View Problem2.kt
package org.rcgonzalezf.onetoten
import java.math.BigInteger
/**
*
* https://projecteuler.net/problem=2
*
* Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
*
View MainActivity.java
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
@rcgonzalezf
rcgonzalezf / aftertask.gradle
Created Aug 2, 2016
Generate code coverage. If on a mac, the afterTask will open the results in the default browser when you use the openinbrowser=true param.
View aftertask.gradle
/*
# source: https://www.reddit.com/r/androiddev/comments/3ig3gm/show_us_your_gradle_tasks/cugju7z
usage:
./gradlew jacocoTestReport -Popeninbrowser=true #opens in browser
./gradlew jacocoTestReport #does not open in browser
*/
configurations {
jacocoReport
}
@rcgonzalezf
rcgonzalezf / Answers for Exercises
Created Feb 20, 2016
Pragmatic Programmer - Orthogonality
View Answers for Exercises
You should check the definition of the authors, I'm sharing my answers here to generate discussion if you think is worth it.
The questions are on page 43 of my edition this might be different on your edition,
I'll only post my answers so please check the questions on the book.
1. Split2 is more orthogonal because it hides the details of the implementation to its consumers.
2. Modeless in general are less dependant of the context so for me this is more orthogonal, and usually a modal dialog depends on the actions or state of the caller, so if you change the caller code or the actions the caller can perform the modal dialog might have to be updated too, leading this type of dialog to be less orthogonal.
3. I'll say procedural,... In theory Object Oriented technology is more orthogonal because it hides the implementation and the state of the code, in procedural more often when you change one of the dependencies it might lead to an undesired impact on the program overall.
At the end in my point of view it dep
@rcgonzalezf
rcgonzalezf / VideoService.java
Created Sep 29, 2015
Upload a Video, using Retrofit.
View VideoService.java
/*
* @author jules
*
*/
public interface VideoServiceProxy {
public static final String DATA_PARAMETER = "data";
public static final String ID_PARAMETER = "id";
public static final String VIDEO_SVC_PATH = "/video";
@rcgonzalezf
rcgonzalezf / TargetSumArray.java
Created Jun 14, 2015
Code for solution of Udemy course.
View TargetSumArray.java
import java.util.HashSet;
import java.util.Set;
/**
* https://www.udemy.com/programming-code-interview/#/lecture/2519488
*/
public class TargetSumArray {
public static void main(String[] args) {
TargetSumArray tsa = new TargetSumArray();
You can’t perform that action at this time.