Skip to content

Instantly share code, notes, and snippets.

View fabirt's full-sized avatar
💻
Learning

Fabian fabirt

💻
Learning
  • Colombia
View GitHub Profile
1. hiltvm (applicable in top-level)
@dagger.hilt.android.lifecycle.HiltViewModel
class $NAME$ @javax.inject.Inject constructor(
$PARAM$
) : androidx.lifecycle.ViewModel() {
$END$
}
2. vmstatefunc (applicable in class)
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$)
@fabirt
fabirt / README.md
Created April 28, 2021 18:55 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@fabirt
fabirt / YouTubeView.swift
Created April 3, 2021 19:52 — forked from Pobe16/YouTubeView.swift
YouTubeView UIViewRepresentable
import SwiftUI
import UIKit
import YouTubePlayer
final class YouTubeView: UIViewRepresentable {
typealias UIViewType = YouTubePlayerView
@ObservedObject var playerState: YouTubeControlState
@fabirt
fabirt / BorderModifier.kt
Created March 16, 2021 13:19 — forked from gildor/BorderModifier.kt
Example of border modifier for Jetpack Compose
import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.compose.ui.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.unit.Dp
/**
* Border definition can be extended to provide border style or [androidx.compose.ui.graphics.Brush]
@fabirt
fabirt / MainActivity.kt
Created August 26, 2020 15:49
Android 11 WindowInsets API Demo
package com.example.windowinsets
import android.graphics.Insets
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsAnimation
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_main.*
@fabirt
fabirt / dart.json
Last active August 24, 2021 23:47
Visual Studio Code Dart/Flutter settings
{
"anonymous_route": {
"prefix": "anroute",
"body": [
"/// Anonymous route for [$1].",
"static Route<void> route() {",
" return MaterialPageRoute(builder: (_) => $1());",
"}"
],
"description": "Generate static function for anonymous route"