Skip to content

Instantly share code, notes, and snippets.

View pedrovgs's full-sized avatar
😃

Pedro Gómez pedrovgs

😃
View GitHub Profile
@pedrovgs
pedrovgs / gist:c424fe754a74f326e997
Created March 23, 2015 14:54
Configure your Activity to be opened when the user taps home button with a long press action.
<activity android:name="AwesomeActivity">
<intent-filter>
<action android:name="android.intent.action.ASSIST"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@drawable/app_icon"/>
</activity>
@pedrovgs
pedrovgs / LoadMoreDetector.java
Created July 30, 2015 15:08
Utility class to implement a load more feature using a RecyclerView widget.
/*
* Copyright (C) 2015 Karumi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@pedrovgs
pedrovgs / FooterAdapteeCollection.java
Created October 16, 2015 09:17
How to use footers and headers with Renderers
import com.pedrogomez.renderers.ListAdapteeCollection;
public class FooterAdapteeCollection<T> extends ListAdapteeCollection<T> {
private boolean showFooter;
public void showFooter() {
this.showFooter = true;
}
@pedrovgs
pedrovgs / MVP_discussion.md
Last active August 2, 2023 16:53
Interfaces for presenters in MVP are a waste of time!

##Interfaces for presenters in MVP are a waste of time!

It's been a long time since we started talking about MVP. Today, the discussion is about if creating an interface for the Presenter in MVP is needed.

This is the Model View Presenter pattern's schema:

MVP Schema

In this schema the Model box is related to all the code needed to implement your business logic, the presenter is the class implementing the presentation logic and the view is an interface created to abstract the view implementation.

@pedrovgs
pedrovgs / FindingTheRightTriangle.md
Created December 27, 2016 16:40
Kata: Finding the right triangle

Find every right triangle that fits all of these conditions:

  • The lengths of the three sides are all integers.
  • The length of each side is less than or equal to a 10.
  • The triangle's perimeter (the sum of the side lengths) is equal to 24.
@pedrovgs
pedrovgs / roman.cj
Created January 13, 2017 15:58
Roman Numerals Kata written in clojure by @Serchinastico
(def table-number->roman
[{:number 1000 :roman "M"}
{:number 900 :roman "CM"}
{:number 500 :roman "D"}
{:number 400 :roman "CD"}
{:number 100 :roman "C"}
{:number 90 :roman "XC"}
{:number 50 :roman "L"}
{:number 40 :roman "XL"}
{:number 10 :roman "X"}

Keybase proof

I hereby claim:

  • I am pedrovgs on github.
  • I am pedrovgs (https://keybase.io/pedrovgs) on keybase.
  • I have a public key whose fingerprint is E86C 312B 2D0A 2FA0 85C1 1BD3 8C96 94DD 6F89 76AA

To claim this, I am signing this object:

DevEGOpers

Llevo unos años trabajando en empresas del sector tecnológico, me dedico al desarrollo de software y creedme cuando os digo que he visto de todo. Empresas, grandes, empresas pequeñas, auto financiadas, con inversión externa, con equipos técnicos brillantes y equipos técnicos como los que puedes encontrar en cualquier otro lugar. Al igual que empresas de todos los colores también he tenido el placer de conocer a todo tipo de programadores y es ahora que ya han pasado unos cuantos años cuando puedo reconocer una serie de patrones que he visto tanto en mi mismo como en la gente que me rodea. En este gist/post voy a intentar plasmar algunos de estos patrones que he me resultan cuanto menos curiosos.

En este post me centraré en los desarrolladores de software porque es el gremio en el que me encuentro, pero seguro que aunque no te dediques a esto podrás encontrar similitudes con tu profesión. Estos son los patrones con los que yo me he econtrado en diferentes empresas y que he podido ver en mi mismo

@pedrovgs
pedrovgs / AndroidSQLIteDatabaseExample.java
Created March 6, 2017 16:46
Working with SQLite in two simple classes
package com.github.pedrovgs.example.storage;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabaseLockedException;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.annotation.NonNull;
import com.github.pedrovgs.example.logger.Logger;
public class SQLDelightStorage {
@pedrovgs
pedrovgs / wrapFunction.scala
Created June 11, 2017 17:11
Declaration of a wrap function using Scala.
type Text = Option[String]
case class ColumnWidth(width: Int)
sealed trait WrapError
case class InvalidText(text: Text) extends WrapError
case class InvalidColumnWidth(width: ColumnWidth) extends WrapError
def wrap(text: Text, width: ColumnWidth): Either[WrapError, Text] = ???