Skip to content

Instantly share code, notes, and snippets.

View olidroide's full-sized avatar
🐍

Oliver Mas olidroide

🐍
View GitHub Profile
@mbarrben
mbarrben / mapper.java
Created October 28, 2014 11:12
Mapper
/**Transforms an input object into an output object */
public interface Mapper<OUT, IN> {
OUT map(IN in);
}
@Sloy
Sloy / build.gradle
Last active August 29, 2015 14:15
Dex Count Gradle
buildscript {
repositories {
jcenter()
maven { url 'http://dl.bintray.com/sloy/maven'} //<- only needed while jcenter refresh to the new version
}
dependencies {
classpath 'com.sloydev:dexcountprettify-plugin:0.1.2'
}
}
/*
* Copyright (C) 2014 Chris Banes
*
* 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
@mbarrben
mbarrben / squash_steps.txt
Last active November 8, 2015 10:30
Squash steps
1. Check out develop and make pull from origin
git checkout develop
git pull
2. Check out your branch
git checkout <your-branch-name-here>
3. Merge develop into your branch
git merge develop
4. git reset --soft origin/develop
5. Commit the pending changes in a single commit
git commit -m "<your-commit-message-here>"
@mbarrben
mbarrben / excel_format.txt
Last active December 10, 2015 22:18
Create full directory structure (also lang code suffix) and localised string.xml files for an Android project from an MS Excel file. For those not using xliff or gettext...
------------------------------------------------
| | lang_code_1 | lang_code_2 | ...
------------------------------------------------
| key_1 | translation | translation | ...
------------------------------------------------
| key_2 | translation | translation | ...
. . .
. . .
. . .
@mbarrben
mbarrben / MediaSelector.java
Last active January 3, 2016 13:39
Create IntentChooser dialog to get images in an Android app. Based on http://stackoverflow.com/a/12347567/626787
public interface MediaSelector {
Intent getIntentChooser();
Uri getMediaUriFromActivityResult(int requestCode, Intent data);
}
@ffgiraldez
ffgiraldez / ToolbarActivity.java
Last active May 4, 2016 16:11
Disable toolbar scroll flag when content it's not enough to fill the screen
public class ToolbarActivity extends AppCompatActivity {
// Set the flags that fit your needs
private static final int ENABLED_SCROLL_BEHAVIOR = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
private static final int DISABLED_SCROLL_BEHAVIOR = 0;
private static final int SCROLL_DOWN = 1;
//Injected via ButterKnife (http://jakewharton.github.io/butterknife)
@InjectView(R.id.toolbar)
Toolbar toolbar;
@InjectView(R.id.recyclerview)
@PaNaVTEC
PaNaVTEC / Coordinator.java
Last active November 4, 2016 22:49
Coordinates various actions and fires a callback when all are complete
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class Coordinator {
private List<String> actions;
private Set<String> completedActions = new TreeSet<>();
private CoordinatorCompleteAction coordinatorCompleteAction;
@stefanhoth
stefanhoth / build.gradle
Last active March 3, 2017 12:03
Simple plugin for build.gradle to instruct Jetbrains IDEA-based IDEs (IntelliJ, Android Studio) to download sources of the dependencies. More settings can be found here: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html
// your code
apply from: "build-plugins/idea-gradle-sources.gradle"
@burgalon
burgalon / gist:5579233
Last active March 9, 2017 00:55
Filter all extra logs "by Log Tax (regex)" in IntelliJ for Android adb logcat that are not relevant to debugging an app
^(?!.*(PullToRefresh|SherlockFragmentActivity|IInputConnectionWrapper|LightsService|CalendarSyncAdapter|Watson|ActionBarSherlock|alsa_ucm|mm-camera|qcom_sensors_hal|CellInfoLte|WirelessDisplayService|TELEPHONY_CALLBACK|StatusBar.*|memalloc|AlarmManager|SIGNAL_ICON|StateMachine|ThermalDaemon|overlay|AudioTrack|Trace|SyncManager|libEGL|GCMBaseIntentService|SubscribedFeeds|PackageManager|StorageNotification|libgps|DownloadManager|MountService|ActivityThread|SpannableStringBuilder|AlertService|Gmail|SurfaceFlinger|PhoneStatusBar|MtpService|PicasaUploader|chromium|BackupHelperDispatcher|BackupManagerService|PerformBackupTask|KeyInputQueue|LocationMasfClient|KeyguardViewMediator|WindowManager|InputDevice|jdwp|RecognizerEngine|VoiceDialerReceiver|PackageIntentReceiver|installd|UNA|VoldCmdListener|UnlockClock|sensor_stub|PowerManagerService|ExchangeService|EventLogService|Finsky|Zygote|BatteryService|SntpClient|ActivityManager|CalendarProvider2|SyncCampaign|AlarmScheduler|StatusBarPolicy|NetworkStatusReceiver|KeyChar