This file contains 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
#include <bits/stdc++.h> | |
using namespace std; | |
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); | |
typedef long long ll; | |
#define endl '\n' | |
#define pb push_back | |
vector<int> l, r, tree, lazy; | |
vector<vector<int>> adj; | |
int N, M, H, o; |
This file contains 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 mqtt = require("mqtt"); | |
const fs = require("fs"); | |
const client = mqtt.connect("mqtt://localhost"); | |
client.on("connect", function () { | |
client.subscribe("test"); | |
}); | |
client.on("message", function (topic, message) { | |
data = JSON.parse(message); |
This file contains 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 re | |
def trim(line): | |
return line.replace(" ", "") | |
def strip_html(data): | |
p = re.compile(r'<.*?>') | |
return p.sub('', data) | |
def make_bullet(line): |
This file contains 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
# <type>: <subject> | |
##### Subject 50 characters ################# -> | | |
# Body Message | |
######## Body 72 characters ####################################### -> | | |
# Issue Tracker Number or URL | |
# --- COMMIT END --- |
This file contains 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.SharedPreferences | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.InternalCoroutinesApi | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.FlowCollector | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.withContext | |
import kotlin.properties.ReadWriteProperty |
This file contains 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
class OnThrottleClickListener( | |
private val dispatcher: CoroutineDispatcher, | |
private val onClickListener: View.OnClickListener, | |
private val interval: Long, | |
) : View.OnClickListener { | |
private var isClickable = true | |
override fun onClick(view: View) { | |
if (isClickable) { |
This file contains 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
fun <T> ComponentActivity.collectLatestLifecycleFlow(flow: Flow<T>, collect: suspend (T) -> Unit) { | |
lifecycleScope.launch { | |
repeatOnLifecycle(Lifecycle.State.STARTED) { | |
flow.collectLatest(collect) | |
} | |
} | |
} |
This file contains 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.graphics.Canvas | |
import android.graphics.drawable.Drawable | |
import androidx.recyclerview.widget.RecyclerView | |
class ItemDecorationWithoutLastItem(private val divider: Drawable) : RecyclerView.ItemDecoration() { | |
override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { | |
super.onDrawOver(c, parent, state) | |
val left = parent.paddingLeft | |
val right = parent.width - parent.paddingRight |
This file contains 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
package com.andevapps.ontv.extension | |
import android.os.Parcel | |
import android.os.Parcelable | |
import androidx.work.Data | |
import java.io.* | |
fun Data.Builder.putParcelable(key: String, parcelable: Parcelable): Data.Builder { | |
val parcel = Parcel.obtain() | |
try { |
OlderNewer