Skip to content

Instantly share code, notes, and snippets.

@hrules6872
hrules6872 / Calendar.kt
Last active April 4, 2023 18:02 — forked from bagus2x/Calendar.kt
Jetpack Compose Simple calendar
@Composable
private fun Calendar(
modifier: Modifier = Modifier,
date: LocalDate
) {
val firstDate = with(date) {
val firstOfMonth = withDayOfMonth(1)
val firstDayOfFirstWeek = firstOfMonth.dayOfWeek.value
firstOfMonth.minusDays(firstDayOfFirstWeek.toLong())
}
@hrules6872
hrules6872 / FadingEdge.kt
Last active April 12, 2023 19:10 — forked from dovahkiin98/FadingEdge.kt
A Jetpack Compose implementation of the `fadingEdge` effect
fun Modifier.horizontalFadingEdge(
scrollState: ScrollState,
length: Dp,
edgeColor: Color? = null,
) = composed(
debugInspectorInfo {
name = "length"
value = length
}
) {
@hrules6872
hrules6872 / obsidian-vii-adjustable-readable-line-length.css
Last active May 15, 2023 06:33 — forked from vii33/obsidian-vii-adjustable-readable-line-length.css
Changes the readable line length in Obsidian Notes
/* Changes the readable line length in Obsidian Notes. Tested in Obsidian v0.15.9
See also: https://forum.obsidian.md/t/adjustable-readable-line-length/7564/6
Note: For this the "readable line length" property in settings has to be enabled
(as expected). 700px width is the application's default, adjust all numbers below.
Pixel (or percentage) as a unit enables a width independent from the number of characters
(good when adjusting zoom level / font size). For fixed amount of characters use rem */
:root {
@hrules6872
hrules6872 / Demo.kt
Last active January 25, 2019 20:47 — forked from alexfu/Demo.kt
Making (Android) Spannable great again with Kotlin
val world = "World"
val spannedText = SpannableString("Hello $world!")
spannedText
.spanWith(world) {
what = BackgroundColorSpan(Color.RED)
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
}
.spanWith(world) {
what = StyleSpan(Typeface.BOLD)
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
@hrules6872
hrules6872 / ParameterizedKotlinTest.kt
Created December 13, 2018 11:09 — forked from rossharper/ParameterizedKotlinTest.kt
Parameterized JUnit4 test example in Kotlin
@RunWith(Parameterized::class)
class KotlinTest(val paramOne: Int, val paramTwo: String) {
companion object {
@JvmStatic
@Parameterized.Parameters
fun data() : Collection<Array<Any>> {
return listOf(
arrayOf(1, "I"), // First test: (paramOne = 1, paramTwo = "I")
arrayOf(1999, "MCMXCIX") // Second test: (paramOne = 1999, paramTwo = "MCMXCIX")
@hrules6872
hrules6872 / gh2bb_migrate_cheapass.py
Created June 8, 2018 18:53
Migrate all your private github repos to bitbucket because you're CHEAP.
__author__ = 'schwa'
import os
import subprocess
import glob
from github import Github # pip install PyGithub
from bitbucket.bitbucket import Bitbucket # pip install --user bitbucket-api
GH_USERNAME = 'jwight@mac.com'
GH_PASSWORD = '1234'
@hrules6872
hrules6872 / android-26-sources.md
Created September 12, 2017 13:28 — forked from cketti/android-26-sources.md
Build your own android-26 sources

If you are annoyed that "Sources for Android 26" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base