Skip to content

Instantly share code, notes, and snippets.

View Sirelon's full-sized avatar
👀
Who are you?

Oleksandr Sirelon

👀
Who are you?
View GitHub Profile
@s0nerik
s0nerik / app.gradle.kts
Last active May 16, 2023 14:46
Android multi-module Gradle setup example
plugins {
id("com.android.application")
}
android {
defaultConfig {
applicationId = "com.example.task"
versionCode = 1
versionName = "1.0"
}
@MarinaShaposhnikova
MarinaShaposhnikova / Throttle.kt
Last active November 24, 2021 22:39
Throttle Coroutines
package com.meier.marina.magiccoroutines
import android.util.Log
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.channels.*
import kotlin.coroutines.experimental.CoroutineContext
class ViewModel {
private var count = 0
@tinmegali
tinmegali / AppDatabse.kt
Last active January 12, 2023 13:44
Android Room @TypeConverter using Kotlin
@Database(entities = arrayOf(Note::class, User::class), version = 1)
@TypeConverters(Converters::class)
abstract class AppDatabse : RoomDatabase() {
abstract fun userDAO(): UserDAO
abstract fun noteDAO(): NoteDAO
}
@stepango
stepango / BindingObservablesExt.kt
Last active November 7, 2018 21:09
Databinding Observable RxJava2 extensions
package com.ninetyseconds.auckland.core.databindings
import android.databinding.*
import android.databinding.Observable.OnPropertyChangedCallback
import android.os.Parcelable
import io.reactivex.Observable
import io.reactivex.Observable.create
import org.funktionale.option.toOption
import java.lang.Math.max
import java.lang.Math.min
@ravidsrk
ravidsrk / coloredLogcat.md
Created February 8, 2016 15:55 — forked from marcjubero/coloredLogcat.md
Colored Logcat - Android Studio

#####Logcat Colors for IntelliJ Darcula Theme (original post)

  • Preferences -> Editor -> Android Logcat
  • "Save As" scheme
  • Uncheck "Use inherited attributes" option
  • Edit foreground color with the following
Debug   : #6897BB 
Info : #6A8759 
@MizzleDK
MizzleDK / DateUtilsFormatDateTime.java
Created September 26, 2015 11:04
Examples with DateUtils.formatDateTime()
long date = 1407869895000L; // August 12, 2014, 8:58PM
// August 12, 2014 (default)
DateUtils.formatDateTime(this, date, 0);
// Aug 12, 2014 (default with abbreviated month)
DateUtils.formatDateTime(this, date, DateUtils.FORMAT_ABBREV_MONTH);
// August 12 (date without year)
DateUtils.formatDateTime(this, date, DateUtils.FORMAT_NO_YEAR);
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@rlac
rlac / Spannable.kt
Created October 10, 2014 09:58
A simple Kotlin builder for creating SpannableStrings. Original idea from https://gist.github.com/JakeWharton/11274467.
// Copyright 2014 Robert Carr
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,