Skip to content

Instantly share code, notes, and snippets.

View roxrook's full-sized avatar
🏃‍♂️
Run To Live 🔥

Chan Nguyen roxrook

🏃‍♂️
Run To Live 🔥
View GitHub Profile
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active May 26, 2024 00:40
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

@NikolaDespotoski
NikolaDespotoski / BottomNavigationBehavior.java
Last active December 19, 2022 06:14
Bottom Navigation behavior
/*
* BottomNavigationLayout library for Android
* Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski).
* 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
public void testExceptionSubjectObserverCustomThrow() {
// setup:
// subject -> observer
// shows that an exception in observer#onNext will call observer#onError,
// and that an unahndled exception in observer#onError will come back to the caller
BehaviorSubject<Integer> subject = BehaviorSubject.create();
@thuytrinh
thuytrinh / ObservableProperty.java
Created January 11, 2015 09:08
A reactivex-based class to represent a mutable property of an object
import rx.Observable;
import rx.functions.Action1;
import rx.subjects.BehaviorSubject;
public class ObservableProperty<T> implements Action1<T> {
private final BehaviorSubject<T> valueSubject;
private T value;
public ObservableProperty() {
valueSubject = BehaviorSubject.create();
@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;
@dpryden
dpryden / ClassLoaderLeakExample.java
Created October 20, 2014 00:01
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@lucasr
lucasr / AnimatedLinearLayout.java
Last active December 16, 2022 19:58
Animated LinearLayout
package com.example.android_transition_samples.app;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
@imminent
imminent / CursorSubject.java
Last active August 11, 2016 17:21
CursorSubject is a Reactive Extension version of Android's CursorLoader. Handles retrieving the Cursor in a background thread, sending the result Cursor on the main thread, and resending a Cursor whenever the content changed notification is triggered.
package com.example.models;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Handler;
import android.os.Looper;
import java.io.Closeable;
import java.util.concurrent.atomic.AtomicReference;
@denji
denji / http-benchmark.md
Last active May 28, 2024 15:48
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)