Skip to content

Instantly share code, notes, and snippets.

View guelo's full-sized avatar
💭
Engineering @PandoraMedia

Miguel Vargas guelo

💭
Engineering @PandoraMedia
View GitHub Profile
class Cell(var state: Char, val north: Cell?, var south: Cell?, var east: Cell?, val west: Cell?) {
var next = state
fun calculateNextPart1() {
val adjacents = listOfNotNull(north, east, west, south, north?.west, north?.east, south?.west, south?.east)
.map { it.state }
next = if (state == 'L' && adjacents.none { it == '#' }) '#'
else if (state == '#' && adjacents.count { it == '#' } > 3) 'L'
@guelo
guelo / day11.kt
Created December 11, 2020 09:49
AOC2020 Day11
package day11
import java.io.File
fun main() {
val grid = File("src/main/kotlin/day11/day11.input")
.readLines().map {
it.toCharArray().toList()
}
@guelo
guelo / blog.md
Last active August 9, 2019 06:48

Announcing Bottom Navigator, an Android open source library

Pandora's latest mobile redesign brings the Bottom Navigation pattern to our apps. Bottom Navigation has become a popular design choice for many apps due to its many advantages including easy one-handed use and the enhanced discoverability of top app destinations.

When Pandora embarked on this project our designers had a clear vision of how navigation should work, a vision that in many ways should be familiar to users of other popular apps with bottom navigation such as Instagram, Youtube and Netflix.

On the Android dev team we surveyed the open source library ecosystem and were unable to find a good fit for our requirements. We realized we would have to build our own and Bottom Navigator was born. We have decided to contribute it back to the Android development community from which we have benefited so much. The library is opinionated and it fits our tech stack, but we believe many other apps share these same opinions and tech stack.

Botto

export PS1="\u:$ "
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/26.0.2:~/scripts:.:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:/usr/local/share/npm/bin:$HOME/bin/gsutil:$HOME/.rvm/bin"
export NODE_PATH="/usr/local/lib/node_modules"
export EDITOR="subl -w"
export GRADLE_OPTS="-Dorg.gradle.daemon=true"
export HISTTIMEFORMAT="%m-%d %T "
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
@guelo
guelo / java-sealed-class.java
Created September 30, 2017 01:27 — forked from rjrjr/java-sealed-class
Poor Man's Sealed Classes (visitor pattern)
/**
* For Java developers all excited by and jealous of Kotlin's sealed classes.
* Do this when you wish you could put parameters on an enum.
*/
public class PoorMan {
interface Event {
<T> T dispatch(EventHandler<T> handler);
}
interface EventHandler<T> {
@guelo
guelo / a.kt
Last active June 26, 2017 18:23
Kotlin class with constructor and annotations formating
@ScreenScope internal class ReservationsPresenter @Inject constructor(private val shiftPresenter: ShiftPresenter, private val reservationRepository: ReservationRepository ) : Presenter<ReservationsFragment>() {
fun hello() {
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
@guelo
guelo / RxSchedulers.java
Last active February 11, 2020 09:42
Dagger injected Rx schedulers
import javax.inject.Named;
import javax.inject.Singleton;
import io.reactivex.Observable;
import io.reactivex.ObservableTransformer;
import io.reactivex.Scheduler;
@Singleton
public class RxSchedulers {
@guelo
guelo / gist:6b74921cb118e36caf175cc91a894969
Created April 25, 2016 19:03
Mock Retrofit2 service interface.
public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
class MockCall<T> implements Call<T> {
@Override
public Response<T> execute() throws IOException { return null; }
@Override