Skip to content

Instantly share code, notes, and snippets.

View shekaroppo's full-sized avatar

Shekar shekaroppo

View GitHub Profile
@shekaroppo
shekaroppo / HostSelectionInterceptor.java
Created August 6, 2016 18:09 — forked from swankjesse/HostSelectionInterceptor.java
This OkHttp application interceptor will replace the destination hostname in the request URL.
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/** An interceptor that allows runtime changes to the URL hostname. */
public final class HostSelectionInterceptor implements Interceptor {
private volatile String host;
@shekaroppo
shekaroppo / .gitignore
Created July 29, 2016 20:08
Idle gitignore file
# Created by https://www.gitignore.io/api/android
### Android ###
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex

Media Playback

  • The Basics

    • MediaPlayer: This class is the primary API for playing sound and video.
    • AudioManager:This class manages audio sources and audio output on a device.
  • Manifest Declarations

    • Internet Permission

      <uses-permission android:name="android.permission.INTERNET" />
      

Test Markdown document

Text

Here is a paragraph with bold text. This is some bold text. Here is a paragraph with bold text. This is also some bold text.

Here is another one with italic text. This is some italic text. Here is

  • Fundamentals
    • Running default task ./gradlew “task name"
    • Running task with filename ./gradlew -b solution.gradle hello
  • Installation
    • java -version
    • $ brew install gradle
    • $ gradle --version
@shekaroppo
shekaroppo / .gitconfig
Created July 18, 2016 18:30 — forked from donnfelker/.gitconfig
My .gitconfig
[user]
name = Your Name
email = you@youremail.com
[alias]
A = add -A
a = add
aa = add --all
ae = add --edit
ai = add --interactive
amend = commit --amend -C HEAD
@shekaroppo
shekaroppo / git-version-control.markdown
Created July 18, 2016 18:08 — forked from albatrocity/git-version-control.markdown
Some basic Git instructions for Github for Mac and the command line

Using Git version control for code projects

Creating a new code repo from a local working copy

  1. From the repositories view in the app, drag the project folder to the bottom of the left sidebar.
  2. Hit "Yes" when it asks if you want to create a local git repository
  3. Go to "Changes" view (⌘2)
  4. Select the files that you want to commit their current state to the repository. You can view the changes of the file by clicking on the double up arrow on the file name bar.
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;
@shekaroppo
shekaroppo / gist:c9a32e36ec83920d89ca90cbefbc64d6
Created July 10, 2016 12:07 — forked from daschl/gist:db9fcc9d2b932115b679
Draft: Writing Code for Production

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)

@shekaroppo
shekaroppo / MainActivity.java
Created June 19, 2016 18:21 — forked from lisawray/MainActivity.java
Vector drawables from XML with the Android support library 23.3.0
package com.xwray.vectorbinding;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;