Skip to content

Instantly share code, notes, and snippets.

View hyoban's full-sized avatar
🏠
Working from home

Stephen Zhou hyoban

🏠
Working from home
View GitHub Profile
@hyoban
hyoban / spotless.gradle
Last active August 28, 2021 15:22
spotless 配置
plugins {
id "com.diffplug.spotless" version "5.14.3"
}
subprojects {
apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target "**/*.kt"
targetExclude("$buildDir/**/*.kt")
@hyoban
hyoban / main.go
Created September 24, 2021 05:41
监听文件夹自动上传到 hdfs
package main
import (
"context"
"database/sql"
"flag"
"log"
"os"
"os/exec"
"strconv"
@hyoban
hyoban / main.py
Created October 1, 2021 13:58
波士顿房价分析,机器学习作业
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.datasets import load_boston
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error, mean_absolute_error
from sklearn.model_selection import train_test_split, learning_curve, ShuffleSplit
@hyoban
hyoban / ResponseAdvisor.kt
Last active October 6, 2021 06:28
Spring Boot 处理统一返回结果和异常
/**
* 处理统一返回结果和异常
*/
@RestControllerAdvice
class ResponseAdvisor : ResponseBodyAdvice<Any> {
data class Result<T>(
val status: Int = HttpStatus.OK.value(),
val message: String = "成功",
val data: T? = null,
@hyoban
hyoban / layout.kt
Created November 15, 2021 13:23
jetpack custom layout example
@Composable
fun MyColumn(
modifier: Modifier = Modifier,
content: @Composable () -> Unit,
) {
Layout(
// apply modifier to layout
modifier = modifier,
// slot for any child composables
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.EnterExitState
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentScope
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.SizeTransform
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.with
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember

Jetpack Compose 动画基础

Transition

动画的过渡效果, 主要有 fade, slide, scale, expand(shrink).

EnterTransition Example

AnimationSpec