Skip to content

Instantly share code, notes, and snippets.

View alexzaitsev's full-sized avatar
:octocat:

Alex Zaitsev alexzaitsev

:octocat:
View GitHub Profile

Successful tests

p3ngu1n@p3ngu1n bitcoin % python3 test/functional/feature_fee_estimation.py
2023-12-18T23:37:21.120000Z TestFramework (INFO): PRNG seed is: 1889367143121386098
2023-12-18T23:37:21.120000Z TestFramework (INFO): Initializing test directory /var/folders/q6/qjgkk7jn6kj_0tyhxx_dlk0m0000gp/T/bitcoin_func_test_srkyz249
2023-12-18T23:37:21.139000Z TestFramework (INFO): This test is time consuming, please be patient
2023-12-18T23:37:21.139000Z TestFramework (INFO): Splitting inputs so we can generate tx's
2023-12-18T23:37:21.751000Z TestFramework (INFO): Finished splitting
2023-12-18T23:37:22.516000Z TestFramework (INFO): Testing estimates with single transactions.
@alexzaitsev
alexzaitsev / DummyTest.kt
Created January 27, 2023 15:00
Dummy test to demonstrate Flow testing
package com.example.domain.usecase
import app.cash.turbine.test
import com.natpryce.hamkrest.assertion.assertThat
import com.natpryce.hamkrest.equalTo
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
import org.junit.Test
class DummyTest {
@alexzaitsev
alexzaitsev / Contract.kt
Created January 23, 2023 16:25
Song Details screen
package com.example.view.screen.song.details
data class SongDetailsViewState(
val author: Author,
val song: Song,
val loading: Boolean
)
sealed class SongDetailsSideEffect {
object ShowNetworkError : SongDetailsSideEffect()
@alexzaitsev
alexzaitsev / DefaultLinkMovementMethod.java
Last active January 17, 2024 08:45
How to display HTML using Android Compose
/**
* Set this on a textview and then you can potentially open links locally if applicable
*/
public class DefaultLinkMovementMethod extends LinkMovementMethod {
private OnLinkClickedListener mOnLinkClickedListener;
public DefaultLinkMovementMethod(OnLinkClickedListener onLinkClickedListener) {
mOnLinkClickedListener = onLinkClickedListener;
}
@alexzaitsev
alexzaitsev / BindingAdapters.kt
Last active December 6, 2018 13:29
AppBarLayout custom shadow
@JvmStatic
@BindingAdapter("isCustomShadowEnabled")
fun setAppBarDefaultShadowEnabled(appBarLayout: AppBarLayout, isCustomShadowEnabled: Boolean) {
if (isCustomShadowEnabled) {
appBarLayout.outlineProvider = null // removes the shadow below the AppBar without affecting elevation
// add the shadow
val inflater = LayoutInflater.from(appBarLayout.context)
val shadowView = inflater.inflate(R.layout.view_shadow, appBarLayout, false)
appBarLayout.addView(shadowView)
}
public static void loadAndCropImage(Context context, @DrawableRes int resourceId, final int smallerSize, ImageView imageView) {
RequestOptions transformation = RequestOptions.bitmapTransform(new Transformation<Bitmap>() {
@Override
public Resource<Bitmap> transform(Context context, Resource<Bitmap> resource, int outWidth, int outHeight) {
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
Bitmap toTransform = resource.get();
Bitmap transformed = TransformationUtils.centerCrop(bitmapPool, toTransform, smallerSize, smallerSize);
final Resource<Bitmap> result;
if (toTransform.equals(transformed)) {
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
@alexzaitsev
alexzaitsev / welcome.js
Last active June 6, 2017 10:36
How To Write Reusable and Testable Code with Microsoft Bot Framework
"use strict";
const builder = require("botbuilder");
const library = new builder.Library('welcome'); // welcome is a library name
const LANGUAGES = {'English': 'en', 'Русский': 'ru'};
library.dialog('/pickLocale', [
(session) => {
// Prompt the user to select their preferred locale
builder.Prompts.choice(session, "What language do you prefer?", Object.keys(LANGUAGES).join("|"));
@alexzaitsev
alexzaitsev / app.js
Last active August 1, 2017 08:50
How To Write Reusable and Testable Code with Microsoft Bot Framework
const bot = new builder.UniversalBot(connector);
bot.dialog(‘/’, [
(session, args, next) => {
if (session.userData.languageSet) {
next();
} else {
session.beginDialog(‘welcome:/pickLocale’);
}
},
...
@alexzaitsev
alexzaitsev / drawable-shadow.xml
Created February 13, 2017 12:29
android manual shadow
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#44000000"
android:startColor="@android:color/transparent" />
</shape>