Skip to content

Instantly share code, notes, and snippets.

View pedrovgs's full-sized avatar
😃

Pedro Gómez pedrovgs

😃
View GitHub Profile
@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"}
@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 / 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 / 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 / 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 / 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>