Skip to content

Instantly share code, notes, and snippets.

View LluisFelip's full-sized avatar

Luis LluisFelip

View GitHub Profile
@alexfdz
alexfdz / postmortem_template.md
Created June 8, 2022 12:00
Postmortem template

YYYYMMDD INCIDENT_NAME

What happened?

Include a timeline

  • Input - when the bug(s) reached production
  • Detection - when the incident was detected. It initiates the incident management process (e.g. SLA for incident resolution starts).
  • Resolution - when the incident was resolved (e.g. through a workaround, final fix, rollback, etc). This is the end of incident management (e.g. SLA for incident resolution ends)

What was the impact?

@kozaxinan
kozaxinan / LabelWithBadge.kt
Last active August 30, 2023 14:02
A Jetpack compose implementation for displaying counter for hidden word becuase of text overflow
package foo
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
@arcadefire
arcadefire / bottomsheet.kt
Created September 12, 2021 12:50
Bottom sheet
enum class States {
EXPANDED,
COLLAPSED
}
@ExperimentalMaterialApi
@Composable
fun FullHeightBottomSheet(
header: @Composable () -> Unit,
body: @Composable () -> Unit
@gpeal
gpeal / ConflatedJob.kt
Last active September 5, 2023 19:10
Conflated Job
class MyClass(private val scope: CoroutineScope) {
private val job = ConflatedJob()
fun retry() {
retryJob += scope.launch {
delay(Long.MAX_VALUE)
}
}
}
@gpeal
gpeal / FragmentA.kt
Last active December 27, 2023 06:50
View Binding Delegates
class WifiNetworksFragment : TonalFragment(R.layout.wifi_networks_fragment) {
// This automatically creates and clears the binding in a lifecycle-aware way.
private val binding: WifiNetworksFragmentBinding by viewBinding()
...
}
class WifiNetworkView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@gpeal
gpeal / fadeTo.kt
Last active August 19, 2023 21:22
Fade To
/**
* Fade a view to visible or gone. This function is idempotent - it can be called over and over again with the same
* value without affecting an in-progress animation.
*/
fun View.fadeTo(visible: Boolean, duration: Long = 500, startDelay: Long = 0, toAlpha: Float = 1f) {
// Make this idempotent.
val tagKey = "fadeTo".hashCode()
if (visible == isVisible && animation == null && getTag(tagKey) == null) return
if (getTag(tagKey) == visible) return
private fun getClient(): WebViewClient {
return object : WebViewClient() {
override fun shouldInterceptRequest(
view: WebView?,
request: WebResourceRequest?
): WebResourceResponse? {
return super.shouldInterceptRequest(view, request)
}
override fun shouldInterceptRequest(view: WebView?, url: String?): WebResourceResponse? {
@simonesestito
simonesestito / layout_with_fab.xml
Created August 5, 2018 16:22
Extended FAB using Material Components on Android
<?xml version="1.0" encoding="utf-8"?><!--
~ Use Extended FAB on Android even if Material Components doesn't support it yet
~ See https://github.com/material-components/material-components-android/issues/79
~
~ Created by Simone Sestito
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
@jaumevn
jaumevn / test.md
Last active June 9, 2018 11:06
Creative HotHouse Android Test

Creative HotHouse Android Test

This document defines the test for the Creative HotHouse Android developer role. For this test, you must create a small application according to the requirements described below. The app must be delivered in less than a week after you receive this document. If for any reason you don’t consider it to be enough time, let us know upon receiving this document.

What to do

You must create a client app to show information about cryptocurrencies, including their price, market cap, volume, etc... In addition to this, the app users must be able to manage their own crypto portfolio.

If you are not familiar with the crypto world you can check the coinmarketcap.com website, which is the most used website to track cryptocurrencies. For instance, you could check information about our J8T token at https://coinmarketcap.com/currencies/jet8/.

// https://gist.github.com/klaasnotfound/e14adefddaf72b941ef4e4245edca7e4
/*
* Copyright 2015 Klaas Klasing (klaas [at] klaasnotfound.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*