Skip to content

Instantly share code, notes, and snippets.

View passsy's full-sized avatar

Pascal Welsch passsy

View GitHub Profile
/**
* 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 May 25, 2023 04:24
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 August 15, 2021 10:05
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).
@passsy
passsy / BasicNetwork.java
Created July 8, 2013 09:52
BasicNetwork fix for Volley with fallback to Cache if the device is offline
/*
* 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
*
* Unless required by applicable law or agreed to in writing, software