This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.RectF; | |
import android.support.annotation.Nullable; | |
import android.util.AttributeSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import appleseed as asr | |
mesh = asr.MeshObject("my_mesh", {}) | |
print mesh | |
# Vertices | |
v0 = asr.Vector3f([0.0, 0.0, 0.0]) | |
v1 = asr.Vector3f([1.0, 0.0, 0.0]) | |
v2 = asr.Vector3f([0.0, 0.0, 1.0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void attachBaseContext(Context newBase) { | |
final Resources resources = newBase.getResources(); | |
final DisplayMetrics displayMetrics = resources.getDisplayMetrics(); | |
if (displayMetrics.densityDpi != (int) displayMetrics.xdpi) { | |
Logger.debug(TAG, "Override configuration!"); | |
final Configuration configuration = resources.getConfiguration(); | |
configuration.densityDpi = (int) displayMetrics.xdpi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vinaysshenoy.sieve; | |
import java.util.List; | |
/** | |
* Created by vinaysshenoy on 03/05/17. | |
*/ | |
public interface Filter<T> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static float spToPx(float sp) { | |
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, Resources.getSystem().getDisplayMetrics()); | |
} |