Skip to content

Instantly share code, notes, and snippets.

View davidtcdeveloper's full-sized avatar

David Tiago Conceição davidtcdeveloper

  • Microsoft
  • Florianópolis, SC
View GitHub Profile
@vgaidarji
vgaidarji / AndroidStudio as git difftool, mergetool
Last active March 13, 2020 09:23
Use AndroidStudio as git difftool/mergetool on MacOS (place this inside your ~/.gitconfig).
[merge]
tool = studio
[mergetool "studio"]
prompt = false
cmd = /Applications/Android\\ Studio.app/Contents/MacOS/studio merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
tool = studio
[difftool "studio"]
prompt = false
@murki
murki / fromAsync-6.java
Last active February 9, 2017 12:58
Wrapping an asynchronous API that uses listeners, by using RxJava Observable.fromAsync
public Observable<SensorEvent> observeSensorChanged(final SensorManager sensorManager, final Sensor sensor, final int samplingPeriodUs) {
return Observable.fromAsync(new Action1<AsyncEmitter<SensorEvent>>() {
@Override
public void call(final AsyncEmitter<SensorEvent> sensorEventAsyncEmitter) {
final SensorEventListener sensorListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
sensorEventAsyncEmitter.onNext(sensorEvent);
}
@miao1007
miao1007 / GradientTransformation.java
Last active October 7, 2023 05:10
Gradient Transformation For Picasso
/**
* Created by Miao1007 on 2/2/15.
*
* Original Code: https://gist.github.com/miao1007/3f7e9b5f011fc188eba6
*/
public class GradientTransformation implements Transformation {
int startColor = Color.argb(240,0,0,0);
int endColor = Color.TRANSPARENT;
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@finalfantasia
finalfantasia / improving_text_antialiasing_and_gui_performance_in_intellij_idea_on_openjdk_8.md
Last active May 5, 2025 21:11
Improving Text Anti-aliasing and GUI Performance in IntelliJ IDEA on OpenJDK 8

This is a list of tweaks to make IntelliJ IDEA work better with OpenJDK 8. Refer to System Properties for Java 2D Technology for the details of the options used below.

Note that the performance boost achieved via the OpenGL-based hardware acceleration pipeline is made possible by using the open-source Radeon driver (for AMD graphics cards) included in the latest stable version (10.3.3 as of now) of the Mesa 3D Graphics Library available in the official Fedora 21 stable repository. Therefore, the gained performance boost might vary based on the types of graphics cards and the versions of the drivers used in your system.

  1. Fixing Text Anti-aliasing in Fedora (Ubuntu users may skip this step.)
  2. Fixing text anti-aliasing in IntelliJ IDEA

In $IDEA_HOME/bin/idea64.vmoptions (or $IDEA_HOME/bin/idea.vmoptions on a x86 architecture), change

@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing
@oraculum
oraculum / gist:3680745
Created September 8, 2012 23:03
Mascara telefone BR para android
package lethus.socialdroid.core.widgets;
import android.content.Context;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.text.method.NumberKeyListener;
import android.util.AttributeSet;
import android.widget.EditText;