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 / 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)

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 / 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?
// ==UserScript==//
// @name Remove Famous LinkedIn Posts
// @namespace RemoveFamousLinkedInPosts
// @description Remove Famous LinkedIn Posts
// @include https://www.linkedin.com/*
// ==/UserScript==
var MAX_NUM_LIKES = 150;
var DEBUG = false;
var INTERVAL = 500;
@androidfanatic
androidfanatic / .bashrc
Last active February 27, 2019 11:12
Alias for myself
# volume up or down
alias vol+="amixer -D pulse sset Master 5%+"
alias vol++="amixer -D pulse sset Master 10%+"
alias vol+++="amixer -D pulse sset Master 15%+"
alias vol-="amixer -D pulse sset Master 5%-"
alias vol--="amixer -D pulse sset Master 10%-"
alias vol---="amixer -D pulse sset Master 15%-"
alias srcedit='nano +99999 ~/.bashrc && source ~/.bashrc'
alias srcupdate='source ~/.bashrc'
@androidfanatic
androidfanatic / theme.css
Last active December 28, 2018 06:37
Stylish theme/skin to prevent procrastination | Set to: facebook.com, reddit.com, news.ycombinator.com, linkedin.com, instagram.com
body:before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
content:"Stop Procrastination!";
background: orangered;
z-index: 99999;
text-align: center;
@androidfanatic
androidfanatic / index.html
Last active January 21, 2019 05:39
Pune Tree Map
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Pune Tree Map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css' rel='stylesheet' />
<style>
@androidfanatic
androidfanatic / index.html
Created March 22, 2019 11:12
Docker 201 - the talk
<!DOCTYPE html>
<html>
<head>
<title>Docker 201</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Indie+Flower);
* {
@androidfanatic
androidfanatic / logger.js
Created March 26, 2019 10:12
Simple winston logger
const winston = require('winston');
const logger = winston.createLogger({
level: 'debug',
exitOnError: true,
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
),
transports: [
{
"workbench.statusBar.visible": false,
"workbench.activityBar.visible": false,
"window.menuBarVisibility": "toggle",
"workbench.editor.enablePreview": false,
"telemetry.enableTelemetry": false,
"editor.tabSize": 2,
"editor.fontSize": 15,
"editor.lineHeight": 26,
"editor.fontLigatures": true,