Skip to content

Instantly share code, notes, and snippets.

Emin Yahyayev ewintory

Block or report user

Report or block ewintory

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AssetUriFetcher.java
package com.wannacorp.util.glide;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.AssetManager;
import android.net.Uri;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.data.DataFetcher;
@avrahamshukron
avrahamshukron / activity
Created May 2, 2015
FloatingActionButton dimming
View activity
@Override
public void onMenuToggle(final boolean isOpen) {
setBackgroundDimming(isOpen);
}
private void setBackgroundDimming(boolean dimmed) {
final float targetAlpha = dimmed ? 1f : 0;
final int endVisibility = dimmed ? View.VISIBLE : View.GONE;
mDimmerView.setVisibility(View.VISIBLE);
mDimmerView.animate()
@kaushikgopal
kaushikgopal / RxFirebase.java
Created Jul 4, 2016 — forked from gsoltis/RxFirebase.java
RxJava Bindings for Firebase
View RxFirebase.java
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
@mformetal
mformetal / PreDrawer.java
Last active Apr 7, 2017
A simple way to add a predraw listener to a view
View PreDrawer.java
public abstract class PreDrawer<T extends View> {
// Private constructor prevent instantiation by the caller. Use addPredrawer() method instead.
private PreDrawer(final T view) {
// Adds the observer to the given view, then calls notifyPredraw() when clean up has been done ready
final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
viewTreeObserver.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
@vrotaru
vrotaru / Base58.java
Created Feb 6, 2012
Base58 encoding an decoding
View Base58.java
package core;
public class Base58 {
private static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
.toCharArray();
private static final int BASE_58 = ALPHABET.length;
private static final int BASE_256 = 256;
private static final int[] INDEXES = new int[128];
@snekse
snekse / Hibernate + Spring ignoring @Column name.md
Last active May 25, 2018
Hibernate + Spring Boot ignoring @column(name="camelCase")
View Hibernate + Spring ignoring @Column name.md
@tonyshkurenko
tonyshkurenko / Dagger 2, quick start
Last active Jun 18, 2018
Everything I found about Dagger 2
View Dagger 2, quick start
Dagger step 1: Add android-apt, dagger 2, dagger2-compiler, and javax annotation to the build.gradle files.
Note that they're not all "compile" dependencies.
Step 2: Add our module. Our ApplicationModule will be able to inject the ApplicationContext to classes that need it.
Step 3: Add our Component.Dagger 2 generates code for each Component you create,
using the file name Dagger(NameOfComponent).
Example: DaggerApplicationComponent.
Components can have multiple modules, in our case we have one.
@katowulf
katowulf / inc_id_rules.js
Last active Jun 24, 2018
Security rules for creating an incremental, numeric ID in Firebase. See http://jsfiddle.net/firebase/xLq7grcc/
View inc_id_rules.js
{
"rules": {
".read": true,
".write": false,
"incid": {
"counter": {
// this counter is set using a transaction and can only be incremented by 1
// the total number of records must be less than 10,000 simply for demo purposes
".write": "newData.isNumber() && ((!data.exists() && newData.val() === 1) || newData.val() === data.val()+1) && newData.val() <= 10000"
},
@yrom
yrom / SpacesItemDecoration.java
Last active Sep 2, 2018
SpacesItemDecoration for RecyclerView.
View SpacesItemDecoration.java
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private int space;
private int spanCount;
private int lastItemInFirstLane = -1;
public SpacesItemDecoration(int space) {
@vgaidarji
vgaidarji / AndroidStudio as git difftool, mergetool
Last active Nov 26, 2018
Use AndroidStudio as git difftool/mergetool on MacOS (place this inside your ~/.gitconfig).
View AndroidStudio as git difftool, mergetool
[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
You can’t perform that action at this time.