Skip to content

Instantly share code, notes, and snippets.

Avatar

Pascal Welsch passsy

View GitHub Profile
View 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:

View gist:40dd5533309b9fcdc1fa
adb shell setprop log.tag.Volley VERBOSE
View gist:8e29670a3166ef4cb047
/**
* 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 Jan 27, 2015
elevatorsaga two queues
View gist:9daebd806436ffb6dc02
{
init: function(elevators, floors) {
_.each(elevators, function(elevator) {
elevator.goToFloor(0);
});
var upQueue = [];
var downQueue = [];
View gist:6974427
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 Dec 30, 2015
LoaderManager.LoaderCallbacks<Cursor> methods with some boilerplate code for a quick CursorLoader start
View gist:7748335
@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 Jun 6, 2016
lazy versionCode with git versioner
View build.gradle
// 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 Sep 14, 2016
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
View ViewModelExample.kt
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 Jan 26, 2017
Fabric gradle plugin bug fix
View _fabricGradleFix.md

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 Jan 27, 2017
ThirtyInch includeBuild
View build.gradle
dependencies {
compile "ThirtyInch:thirtyinch"
compile "ThirtyInch:thirtyinch-rx"
compile "ThirtyInch:thirtyinch-plugin"
testCompile "ThirtyInch:thirtyinch-test"
}