Skip to content

Instantly share code, notes, and snippets.

Avatar

Joan Pujol lujop

View GitHub Profile
@lujop
lujop / gist:e53d46eeaca432c444ec1c7fa4110827
Created Dec 5, 2017
Gist for Mapstruct #1345 Ignore doesn't works for readonly properties
View gist:e53d46eeaca432c444ec1c7fa4110827
package cat.joanpujol;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
public class Test {
}
@lujop
lujop / TestVC.swift
Created Nov 24, 2016
Problem applying constraint to UIStackView
View TestVC.swift
// File.swift
// Medicaments
//
// Created by Joan Pujol Espinar on 22/11/2016.
// Copyright © 2016 Joan Pujol. All rights reserved.
//
import UIKit
class TestVC : UIViewController {
View SafeFragmentPagerAdapter.java
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 Oct 18, 2016
Minimal changes to FragmentPagerAdapter to make it safe between screen rotations.
View SafeFragmentPagerAdapter.java
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 Oct 13, 2016
Foreground service that can be shared with several activities
View ForeGroundService.java
package cat.joanpujol.androidbase.services.foreground;
/**
* Created by lujop on 11/10/16.
*/
public interface ForegroundService {
void onCreate();
void onDestroy();
}
View FirebaseOnlineTracker
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 Jun 13, 2016 — forked from gsoltis/RxFirebase.java
RxJava Bindings for Firebase
View RxFirebase.java
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 Apr 12, 2016
Glide loader to load contacts images
View ContactsGlideLoader.java
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;