Skip to content

Instantly share code, notes, and snippets.

View passsy's full-sized avatar

Pascal Welsch passsy

View GitHub Profile
@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:40dd5533309b9fcdc1fa
Created September 2, 2014 18:13
volley logging
adb shell setprop log.tag.Volley VERBOSE
/**
* elevatorsaga level 10 - single queue
* http://play.elevatorsaga.com/#challenge=10
**/
{
init: function(elevators, floors) {
_.each(elevators, function(elevator) {
elevator.goToFloor(0);
});
@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 = [];
@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 / 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 / build.gradle
Last active June 6, 2016 12:44
lazy versionCode with git versioner
// Optional: configure the versioner (before applying the script)
/* ext.gitVersioner = [
defaultBranch : "develop", // default "master"
yearFactor : 1200, // default "1000", increasing every 8.57h
snapshotEnabled : false, // default false, the "-SNAPSHOT" postfix
localChangesCountEnabled: false // default false, the (<commitCount>) before -SNAPSHOT
] */
apply from: 'https://raw.githubusercontent.com/passsy/gradle-GitVersioner/master/git-versioner.gradle'
android {
@passsy
passsy / ViewModelExample.kt
Last active September 14, 2016 13:43
VPVM Example of a ViewModel which can be used inside a ThirtyInch TiPresenter. This is built with Kotlin and Rx. While you may not use those technologies in your app you get the idea
private class ViewModel {
private var changing = PublishSubject.create<Unit>()
fun observe(): Observable<ViewModel> {
return Observable.just(this).mergeWith(changing.map { this })
}
var results: List<SearchResult> by onChangeNotifySubject(emptyList(), changing,
{ p, o, newValue -> if (newValue.isEmpty()) selectedResult = null })
@passsy
passsy / _fabricGradleFix.md
Last active January 26, 2017 10:33
Fabric gradle plugin bug fix

The fabric gradle plugin io.fabric.tools:gradle:1.21.7 generates the crashlytics xml containing the project ID over and over again even when the file exists. The regeneration of the generated resource forces the generateDevDebugResValues task to perform again. It can't skip with the state UP-TO-DATE.

The plugin should check if the file with the correct content already exists before it gets changed.

Even worse when the firebase com.google.gms.google-services is included as dependency. It also checks for changed resources and starts all over again.

@passsy
passsy / build.gradle
Created January 27, 2017 19:01
ThirtyInch includeBuild
dependencies {
compile "ThirtyInch:thirtyinch"
compile "ThirtyInch:thirtyinch-rx"
compile "ThirtyInch:thirtyinch-plugin"
testCompile "ThirtyInch:thirtyinch-test"
}