Skip to content

Instantly share code, notes, and snippets.

View aoc2020-day11.kt
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 / day11.kt
Created Dec 11, 2020
AOC2020 Day11
View day11.kt
package day11
fun main() {
val grid = File("src/main/kotlin/day11/day11.input")
.readLines().map {

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.


View .bash_profile
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 /
Created Sep 30, 2017 — 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 / a.kt
Last active Jun 26, 2017
Kotlin class with constructor and annotations formating
View a.kt
@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 /
Last active Feb 11, 2020
Dagger injected Rx schedulers
import javax.inject.Named;
import javax.inject.Singleton;
import io.reactivex.Observable;
import io.reactivex.ObservableTransformer;
import io.reactivex.Scheduler;
public class RxSchedulers {
guelo / gist:6b74921cb118e36caf175cc91a894969
Created Apr 25, 2016
Mock Retrofit2 service interface.
View gist:6b74921cb118e36caf175cc91a894969
public interface GitHubService {
Call<List<Repo>> listRepos(@Path("user") String user);
class MockCall<T> implements Call<T> {
public Response<T> execute() throws IOException { return null; }