Skip to content

Instantly share code, notes, and snippets.

View igoticecream's full-sized avatar

Pedro Díaz igoticecream

View GitHub Profile
@igoticecream
igoticecream / Singleton.java
Created January 31, 2017 18:53
Doble check singleton implementation
@SuppressWarnings({"unused", "FieldCanBeLocal", "WeakerAccess"})
public final class Singleton {
private static volatile Singleton ourInstance = null;
public static Singleton getInstance() {
if (ourInstance == null) {
synchronized (Singleton.class) {
if (ourInstance == null) {
ourInstance = new Singleton();
@igoticecream
igoticecream / RxBus.java
Created January 31, 2017 18:49
Event bus implementation with RxJava 2
import com.jakewharton.rxrelay2.PublishRelay;
import com.jakewharton.rxrelay2.Relay;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
@SuppressWarnings({"unused", "FieldCanBeLocal", "WeakerAccess"})
public final class RxBus {
Copyright (c) $today.year. Pedro Díaz <igoticecream@gmail.com>
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
distributed under the License is distributed on an "AS IS" BASIS,
@igoticecream
igoticecream / Utils.scala
Last active January 31, 2017 18:35
Example of implicit classes on Scala
package com.igoticecream.wrike.util
object Utils {
implicit class IntWithTimes(x: Int) {
def times[A](f: => A): Unit = {
def loop(current: Int): Unit = {
if (current > 0) {
f
@igoticecream
igoticecream / idea.vmoptions
Created January 31, 2017 18:29
Custom IntelliJ IDEA VM options
# custom IntelliJ IDEA VM options
-server
-Xms2g
-Xmx2g
-XX:NewRatio=3
-Xss16m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
@igoticecream
igoticecream / idea.properties
Created January 31, 2017 18:28
Custom IntelliJ IDEA properties
# custom IntelliJ IDEA properties
editor.zero.latency.typing=true
@igoticecream
igoticecream / colors.xml
Created February 29, 2016 20:18
Google's material design color palette resource file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
<color name="red_400">#EF5350</color>
<color name="red_500">#F44336</color>
<color name="red_600">#E53935</color>