This file contains hidden or 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 androidx.compose.foundation.background | |
| import androidx.compose.foundation.border | |
| import androidx.compose.foundation.layout.Arrangement | |
| import androidx.compose.foundation.layout.Box | |
| import androidx.compose.foundation.layout.Row | |
| import androidx.compose.foundation.layout.height | |
| import androidx.compose.foundation.layout.width | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Alignment | |
| import androidx.compose.ui.Modifier |
This file contains hidden or 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 androidx.compose.runtime.Immutable | |
| import androidx.compose.runtime.Stable | |
| import androidx.compose.ui.graphics.Color | |
| import kotlinx.coroutines.Dispatchers | |
| import kotlinx.coroutines.withContext | |
| import kotlin.math.pow | |
| import kotlin.math.sqrt | |
| @Stable | |
| suspend fun findNearestColor(color: Int): PaletteColor = withContext(Dispatchers.Default) { |
This file contains hidden or 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 androidx.compose.material.icons.Icons | |
| import androidx.compose.ui.graphics.vector.ImageVector | |
| fun getIconByName(icon: String, set: IconsSet = IconsSet.Filled): ImageVector = | |
| Class.forName("androidx.compose.material.icons.${set.name.lowercase()}.${icon}Kt") | |
| .getMethod("get$icon", set.toIcons().javaClass) | |
| .invoke(set.toIcons(), set.toIcons()) as ImageVector | |
| enum class IconsSet { | |
| Filled, Outlined, Rounded, TwoTone; |
This file contains hidden or 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 android.content.res.Configuration | |
| import android.graphics.Bitmap | |
| import androidx.compose.foundation.Canvas | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.Box | |
| import androidx.compose.foundation.layout.Column | |
| import androidx.compose.foundation.layout.fillMaxWidth | |
| import androidx.compose.foundation.layout.height | |
| import androidx.compose.foundation.layout.padding | |
| import androidx.compose.foundation.shape.RoundedCornerShape |
This file contains hidden or 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 androidx.compose.animation.core.animateFloatAsState | |
| import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.composed | |
| import androidx.compose.ui.draw.drawWithContent | |
| import androidx.compose.ui.geometry.Offset | |
| import androidx.compose.ui.geometry.center | |
| import androidx.compose.ui.graphics.BlendMode | |
| import androidx.compose.ui.graphics.Color | |
| import androidx.compose.ui.graphics.drawscope.DrawScope | |
| import androidx.compose.ui.graphics.drawscope.rotate |
This file contains hidden or 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 android.content.Context | |
| import android.graphics.Canvas | |
| import android.graphics.Paint | |
| import androidx.core.view.children | |
| import androidx.recyclerview.widget.RecyclerView | |
| class DebugItemDecoration(context: Context) : RecyclerView.ItemDecoration() { | |
| private val borderColor = context.getColor(android.R.color.holo_purple) | |
| private val leftColor = context.getColor(android.R.color.holo_red_light) |
This file contains hidden or 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 android.os.SystemClock | |
| import timber.log.Timber | |
| import kotlin.time.Duration | |
| class TimingLogger(tag: String) { | |
| private val tag: String = tag | |
| get() = "T/$field" | |
| private var splits = mutableMapOf<String, Long>() |
This file contains hidden or 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
| const sketch = require('sketch/dom') | |
| const UI = require('sketch/ui') | |
| const Group = sketch.Group | |
| const Rectangle = sketch.Rectangle | |
| const Slice = sketch.Slice | |
| const document = require('sketch').getSelectedDocument() | |
| const page = document.selectedPage | |
| if (document.selectedLayers.isEmpty) { |
This file contains hidden or 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 csv | |
| import glob | |
| import os | |
| import shutil | |
| import sys | |
| import urllib.request | |
| if len(sys.argv) != 2: | |
| print('Usage: ' + sys.argv[0] + ' [path to project]') | |
| sys.exit() |
This file contains hidden or 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
| android_gifify() { | |
| adb shell screenrecord --bit-rate 8000000 --time-limit ${1:-5} /sdcard/record.mp4 | |
| adb pull /sdcard/record.mp4 | |
| adb shell rm /sdcard/record.mp4 | |
| gifify record.mp4 --good | |
| rm -rf record.mp4 | |
| } |
NewerOlder