Skip to content

Instantly share code, notes, and snippets.

View Swisyn's full-sized avatar

Dzhunet Hasan Swisyn

  • kleinanzeigen GmbH
  • Berlin, Germany
  • 14:10 (UTC +01:00)
View GitHub Profile
@AkdM
AkdM / .gitignore
Last active December 12, 2024 10:55
Daily backup Home Assistant configuration into a git repository
# You can whitelist files/folders with !, those will not be ignored.
# Everything that starts with a / are for root elements
# ignore
/custom_components/
/zigbee2mqtt/log
/zigbee2mqtt/state.json
/home-assistant_v2.* # Exclude Home Assistant history-related database. Make sure to enable git LFS if you don't exclude that, since those files can go easily over 100MB
/home-assistant.log*
/.ssh/
@mertceyhan
mertceyhan / TypewriterTextEffect.kt
Created May 8, 2023 13:54
TypewriterTextEffect: A customizable Jetpack Compose function that reveals text with a typewriter-like effect, one chunk at a time
/**
* A composable function that displays a text with a typewriter-like effect, revealing characters in chunks.
*
* @param text The input text to be displayed with the typewriter effect.
* @param minDelayInMillis The minimum delay in milliseconds between revealing character chunks, defaults to 10ms.
* @param maxDelayInMillis The maximum delay in milliseconds between revealing character chunks, defaults to 50ms.
* @param minCharacterChunk The minimum number of characters to reveal at once, defaults to 1.
* @param maxCharacterChunk The maximum number of characters to reveal at once, defaults to 5.
* @param onEffectCompleted A callback function invoked when the entire text has been revealed.
* @param displayTextComposable A composable function that receives the text to display with the typewriter effect.
@zhuowei
zhuowei / Ensemble.plist
Last active September 18, 2023 06:26
Put this file as /Library/Preferences/FeatureFlags/Domain/Ensemble.plist and reboot to (hopefully) turn on Universal Control on macOS 12
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- not sure which one it is, so set both -->
<key>Ensemble</key>
<dict>
<key>Enabled</key>
<true/>
</dict>
<style name="TopSheet_DialogAnimation">
  <item name="android:windowEnterAnimation">@anim/slide_out_from_top</item>
  <item name="android:windowExitAnimation">@anim/slide_back_to_top</item>
</style>

slide_out_from_top

@frankfka
frankfka / iOSActivityRingSwiftUI.swift
Created April 29, 2020 05:22
iOS Activity Ring in SwiftUI
import SwiftUI
import PlaygroundSupport
extension Double {
func toRadians() -> Double {
return self * Double.pi / 180
}
func toCGFloat() -> CGFloat {
return CGFloat(self)
@osipxd
osipxd / tooling.md
Last active March 22, 2022 12:56
Tooling. Tips&Tricks - Notes

Tooling. Tips&Tricks

Материалы к докладу на митап Redmadrobot 30 апреля.

Habr | YouTube | Презентация

Git

  • Merging vs. Rebasing - сравнение подходов с merge и rebase от Atlassian. У них вообще много хороших статей, очень советую.
  • Why you should stop using Git rebase - какие сложности могут возникнуть, если чрезмерно увлечься rebase.
  • Pro Git. Git Tools - Rewriting History - глава из книги Pro Git. Подробно описывается работа с interactive rebase. Про stash, patch, cherry-pick можно почитать там же.
@osipxd
osipxd / ViewBinding.kt
Last active May 20, 2020 05:04
View binding extensions + delegate
/**
* Инфлейт ViewBinding заданного типа [T].
*
* В качестве родителя используется [ViewGroup], по умолчанию view прикрепляется к корню родителя.
* **ВАЖНО!** Для инфлейта вьюх с `merge` в корне нужно использовать только этот метод.
*/
inline fun <reified T : ViewBinding> ViewGroup.inflateViewBinding(
context: Context = this.context,
attachToRoot: Boolean = true
): T {
@osipxd
osipxd / ViewModelFactory.kt
Created March 27, 2020 14:48
Dagger ViewModel Multibinding
class ViewModelFactory @Inject constructor(
private val providers: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
val provider = providers[modelClass]
?: providers.asIterable().find { modelClass.isAssignableFrom(it.key) }?.value
?: error("Unknown ViewModel class $modelClass")
return try {
import UIKit
struct Action {
let title: String
let style: UIAlertAction.Style
let action: () -> Void
}
extension Action {
static func `default`(_ title: String, action: @escaping () -> Void) -> [Action] {
@RBusarow
RBusarow / TestCoroutineExtension.kt
Last active November 20, 2023 19:03
A JUnit 4 Rule and JUnit 5 Extension for utilizing TestCoroutineDispatcher and TestCoroutineScope from kotlinx.coroutines-test
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.jupiter.api.extension.AfterAllCallback
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.BeforeAllCallback
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.extension.ExtensionContext