Skip to content

Instantly share code, notes, and snippets.

Vinay S Shenoy vinaysshenoy

Block or report user

Report or block vinaysshenoy

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
@vinaysshenoy
vinaysshenoy / build.gradle
Last active Nov 25, 2018
Publish To Maven (S3 Backed) using new plugin
View build.gradle
apply from: 'secrets.gradle'
group 'com.vinaysshenoy'
version '1.0-SNAPSHOT'
buildscript {
ext {
common = [
kotlin: '1.3.10'
]
@vinaysshenoy
vinaysshenoy / TextAnnotations.kt
Created Oct 12, 2018
Android Resource Annotation Applier
View TextAnnotations.kt
package com.vinaysshenoy.util
import android.content.Context
import android.graphics.Typeface
import android.support.annotation.StringRes
import android.support.v4.content.res.ResourcesCompat
import android.text.Annotation
import android.text.Spannable
import android.text.SpannableString
import android.text.SpannedString
@vinaysshenoy
vinaysshenoy / README.md
Created May 21, 2018 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)
View README.md

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

View Contract.kt
sealed class PresenterToViewMsg
data class Msg1(val prop: Int): PresenterToViewMsg()
data class Msg2(val prop: String): PresenterToViewMsg()
sealed class ViewToPresenterMsg
data class Msg3(val prop: Int): ViewToPresenterMsg()
data class Msg4(val prop: String): ViewToPresenterMsg()
@vinaysshenoy
vinaysshenoy / ReduceTest.kt
Created Apr 28, 2018
Using reduce to find a single element in an Observable chain
View ReduceTest.kt
import io.reactivex.Observable
data class Item(val priority: Int)
Observable.fromArray(Item(10), Item(5), Item(25))
.reduce { first, next -> if(first.priority < next.priority) first else next }
.toSingle() //This converts a Maybe to a Single that will emit an error if there are no elements in the stream
.subscribe({ println("Least priority: $it") }, {})
@vinaysshenoy
vinaysshenoy / Test.kt
Last active Mar 27, 2018
Shared observable test
View Test.kt
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit.SECONDS
import java.util.concurrent.atomic.AtomicInteger
val counter = AtomicInteger()
val source = Observable
.fromCallable {
println("\nCalled")
val number = counter.incrementAndGet()
@vinaysshenoy
vinaysshenoy / GsonExtensions.kt
Created Dec 30, 2017
Gson Extension Functions
View GsonExtensions.kt
package com.vinaysshenoy
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonToken.NULL
inline fun JsonReader.parseObject(keys: Set<String>, block: JsonReader.(String) -> Unit) {
beginObject()
while (hasNext()) {
val key = nextName()
if (key in keys) {
@vinaysshenoy
vinaysshenoy / ActivityLifecycles.kt
Last active Nov 24, 2017
Reactive Activity Lifecycles
View ActivityLifecycles.kt
package com.vinaysshenoy.android.arch
import com.vinaysshenoy.android.arch.Event.DESTROY
import com.vinaysshenoy.android.arch.Event.PAUSE
import com.vinaysshenoy.android.arch.Event.RESUME
import com.vinaysshenoy.android.arch.Event.START
import com.vinaysshenoy.android.arch.Event.STOP
import io.reactivex.Observable
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.subjects.PublishSubject
@vinaysshenoy
vinaysshenoy / .bash_profile
Created Oct 26, 2017
Run emulator via command line
View .bash_profile
# Add Android SDK Emulator binary to path
export PATH=:<Path To Android SDK>/emulator
# Add alias for running any emulator
alias run_avd='function _run_avd(){ emulator -avd $1 -dns-server 8.8.8.8; };_run_avd'
# To run emulator via command line, there are 2 steps
# $emulator -list-avds
# Above command will list al AVDS available, copy the one you want to launch
View MatrixViewTestFinal.java
package com.vinaysshenoy.multitouch.widget.matrixtest;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.support.annotation.Nullable;
You can’t perform that action at this time.