Skip to content

Instantly share code, notes, and snippets.

View rahulsainani's full-sized avatar

Rahul Sainani rahulsainani

View GitHub Profile
import os
import glob
import pandas as pd
def combine_csv():
"""Combine all files in the list and export to CSV"""
os.chdir("<directory_where_all_csvs_are>")
@rahulsainani
rahulsainani / App.kt
Last active November 3, 2020 15:01
Clean Cache Worker
import android.app.Application
import androidx.work.Constraints
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import java.util.concurrent.TimeUnit
class App: Application(){
override fun onCreate() {
@Composable
fun AppProgressBar() {
CircularProgressIndicator(color = Theme.colors.onBackground)
}
Row(
modifier = Modifier.padding(
horizontal = AppTheme.dimens.grid_2,
vertical = AppTheme.dimens.grid_3
),
) {
...
}
@Deprecated(
message = "Use AppTheme.dimens instead to support smaller screen sizes as well",
replaceWith = ReplaceWith(expression = "AppTheme.dimens", imports = ["_.ui.theme.AppTheme"])
)
object Dimens {
...
}
class Dimensions(
...
class Dimensions(
val grid_0_25: Dp,
val grid_0_5: Dp,
val grid_1: Dp,
val grid_1_5: Dp,
val grid_2: Dp,
val grid_2_5: Dp,
val grid_3: Dp,
val grid_3_5: Dp,
val grid_4: Dp,
/**
* An 8dp grid system. Smaller components can align to a 2dp 'sub' grid.
*/
object Dimens {
val grid_0_25 = 2.dp
val grid_0_5 = 4.dp
val grid_1 = 8.dp
val grid_1_5 = 12.dp
val grid_2 = 16.dp
val grid_2_5 = 20.dp
// To simplfy the example, we will use the defaults provided in the Material Theme
private val LightThemeColors = lightColors()
private val DarkThemeColors = darkColors()
@Composable
fun ProvideAppColors(
colors: Colors,
content: @Composable () -> Unit
) {
@Composable
fun ProvideDimens(
dimensions: Dimensions,
content: @Composable () -> Unit
) {
val dimensionSet = remember { dimensions }
CompositionLocalProvider(LocalAppDimens provides dimensionSet, content = content)
}
private val LocalAppDimens = staticCompositionLocalOf {
data class Feature(
@DrawableRes val iconResource: Int,
val contentDescription: String,
)