Skip to content

Instantly share code, notes, and snippets.

View passsy's full-sized avatar

Pascal Welsch passsy

View GitHub Profile
@passsy
passsy / OperatorSemaphore.java
Created April 28, 2015 14:33
A Presenter when using RxAndroid which delays delivering to the View when the View isn't ready
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Konstantin Mikheev sirstripy-at-gmail-com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@passsy
passsy / gist:9daebd806436ffb6dc02
Created January 27, 2015 10:06
elevatorsaga two queues
{
init: function(elevators, floors) {
_.each(elevators, function(elevator) {
elevator.goToFloor(0);
});
var upQueue = [];
var downQueue = [];
/**
* elevatorsaga level 10 - single queue
* http://play.elevatorsaga.com/#challenge=10
**/
{
init: function(elevators, floors) {
_.each(elevators, function(elevator) {
elevator.goToFloor(0);
});
@passsy
passsy / material text sizes.md
Last active September 2, 2025 04:36
Material font sizes
@passsy
passsy / A_README.md
Last active January 24, 2024 05:56
Android Studio Light Theme

Colorful Java (and Kotlin) Android Studio Theme

This Android Studio Theme (or IntelliJ in general) is based on many IDEs.

Previews

@passsy
passsy / gist:40dd5533309b9fcdc1fa
Created September 2, 2014 18:13
volley logging
adb shell setprop log.tag.Volley VERBOSE
@passsy
passsy / ArrayAdapter.java
Last active February 28, 2025 10:00
ArrayAdapter for RecyclerView
package com.pascalwelsch.utils;
import android.support.annotation.Nullable;
import android.support.v7.util.DiffUtil;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@passsy
passsy / keybase.md
Created April 29, 2014 19:07
keybase.md

Keybase proof

I hereby claim:

  • I am passsy on github.
  • I am passsy (https://keybase.io/passsy) on keybase.
  • I have a public key whose fingerprint is F324 9507 7196 3722 893D F1F6 7172 7F0D 5DDC 5507

To claim this, I am signing this object:

@passsy
passsy / gist:7748335
Last active December 30, 2015 00:19
LoaderManager.LoaderCallbacks<Cursor> methods with some boilerplate code for a quick CursorLoader start
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle bundle) {
// Initialize the CurosorLoader
final int code = id - this.hashCode();
switch (code) {
case ID1:
String selection = null;
return new CursorLoader(getActivity(), CONTENT_URI, null,
selection, null, null);
@passsy
passsy / gist:6974427
Created October 14, 2013 11:47
Not working Prolog solution for Einsteins Riddle Game. http://www.flashanywhere.net/en/actiongames/18189-einsteins-riddle.html/
live(british, red).
pet(swedish, dog).
drink(danish, tea).
nextto(green, white).
house(A, N) :- live(A, green), live(B, white), house(B, M), M < N.
left(green, white).
right(white, greem).
live(X, green) :- drink(X, coffee).
smoke(Z, pallmall) :- pet(Z, bird).
live(X, yellow) :- smoke(X, dunhill).