Skip to content

Instantly share code, notes, and snippets.

Tomer Goldstein tomergoldst

Block or report user

Report or block tomergoldst

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
tomergoldst / Singleton.kt
Last active Nov 27, 2018
Kotlin singleton pattern with class paramters
View Singleton.kt
class Singelton private constructor(context: Context) {
companion object {
private var INSTANCE: Singelton? = null
fun getInstance(context: Context): Singelton =
INSTANCE ?: synchronized(this) {
INSTANCE ?: Singelton(context).also { INSTANCE = it }
tomergoldst /
Last active Dec 2, 2018
Key-Value store interface and shared preferences implementation example plus memory (mock) implemetnation
public interface KeyStoreDataSource {
String getString(String key, String defaultValue);
void putString(String key, String value);
int getInt(String key, int defaultValue);
void putInt(String key, int value);
long getLong(String key, long defaultValue);
void putLong(String key, long value);
float getFloat(String key, float defaultValue);
void putFloat(String key, float value);
tomergoldst / KeyStoreDataSource.kt
Created Dec 2, 2018
Key-Value store interface and shared preferences implementation example plus memory (mock) implemetnation in Kotlin
View KeyStoreDataSource.kt
interface KeyStoreDataSource {
fun getString(key: String, defaultValue: String?): String?
fun putString(key: String, value: String?)
fun getInt(key: String, defaultValue: Int): Int
fun putInt(key: String, value: Int)
fun getLong(key: String, defaultValue: Long): Long
fun putLong(key: String, value: Long)
fun getFloat(key: String, defaultValue: Float): Float
fun putFloat(key: String, value: Float)
tomergoldst /
Last active Jan 20, 2019
An implementation of PagerAdapter for views
* View Pager Adapter - An implementation of PagerAdapter for views
* Simplified implementation which enables access to created view at a specific position
* for controlling the view status and force pre creation of a view when necessary
* Created by tomergoldst on 15/11/2018.
public abstract class ViewPagerAdapter<T> extends PagerAdapter {
You can’t perform that action at this time.