Skip to content

Instantly share code, notes, and snippets.

View lujop's full-sized avatar

Joan Pujol lujop

View GitHub Profile
@lujop
lujop / gist:e53d46eeaca432c444ec1c7fa4110827
Created December 5, 2017 22:26
Gist for Mapstruct #1345 Ignore doesn't works for readonly properties
package cat.joanpujol;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
public class Test {
}
@lujop
lujop / TestVC.swift
Created November 24, 2016 11:23
Problem applying constraint to UIStackView
// File.swift
// Medicaments
//
// Created by Joan Pujol Espinar on 22/11/2016.
// Copyright © 2016 Joan Pujol. All rights reserved.
//
import UIKit
class TestVC : UIViewController {
@lujop
lujop / SafeFragmentPagerAdapter.java
Last active October 18, 2016 11:05
Minimal changes to FragmentPagerAdapter to make it safe between screen rotations. Some comments at http://stackoverflow.com/questions/19393076/how-to-properly-handle-screen-rotation-with-a-viewpager-and-nested-fragments
package cat.joanpujol.androidbase.adapter;
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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
@lujop
lujop / SafeFragmentPagerAdapter.java
Created October 18, 2016 11:05
Minimal changes to FragmentPagerAdapter to make it safe between screen rotations.
package cat.joanpujol.androidbase.adapter;
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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
@lujop
lujop / ForeGroundService.java
Created October 13, 2016 14:23
Foreground service that can be shared with several activities
package cat.joanpujol.androidbase.services.foreground;
/**
* Created by lujop on 11/10/16.
*/
public interface ForegroundService {
void onCreate();
void onDestroy();
}
package cat.joanpujol.firebase;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
@lujop
lujop / RxFirebase.java
Created June 13, 2016 16:41 — forked from gsoltis/RxFirebase.java
RxJava Bindings for Firebase
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
@lujop
lujop / ContactsGlideLoader.java
Created April 12, 2016 18:23
Glide loader to load contacts images
package cat.joanpujol.utils.glide;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.data.DataFetcher;
import com.bumptech.glide.load.model.ModelLoader;