Skip to content

Instantly share code, notes, and snippets.

View androidfanatic's full-sized avatar
🏠
Working from home

ManishRaj androidfanatic

🏠
Working from home
View GitHub Profile
@androidfanatic
androidfanatic / react_fiber.md
Created April 19, 2017 04:40 — forked from geoffreydhuyvetters/react_fiber.md
What is React Fiber? And how can I try it out today?

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@androidfanatic
androidfanatic / Caching.java
Created January 16, 2016 14:01
Caching with retrofit 2.0.0
private OkHttpClient getCacheClient(final Context context) {
Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() {
@Override public okhttp3.Response intercept(Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
if (isNetworkAvailable(MainApp.getContext())) {
// Internet available; read from cache for 1 day
// Why? Reduce server load, better UX
int maxAge = 60 * 60 * 24;
return originalResponse.newBuilder()
.header("Cache-Control", "public, max-age=" + maxAge)