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
/** | |
* 按间隔更新数字,数字增长的动画。 | |
* | |
* @param start 动画开始的值 | |
* @param end 动画最后结束的值 | |
* @param updateFn 更新值状态的方法 | |
* @param duration 动画总时长 | |
* @param setpDuration 每次更新的间隔 | |
* @param precision 数字精度 | |
* |
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
struct ByteIter<'remainder> { | |
remainder: &'remainder [u8], | |
} | |
/* impl<'remainder> ByteIter<'remainder> { | |
fn next(&mut self) -> Option<&'remainder u8> { | |
if self.remainder.is_empty() { | |
None | |
} else { | |
let byte = &self.remainder[0]; |
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
/** | |
* clsx | |
*/ | |
export function cn(...rest: string[]) { | |
return rest.join(' '); | |
} | |
/** | |
* 构建 cn 函数 | |
* |
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
.body { | |
display: flex; | |
} | |
.btn { | |
display: flex; | |
position: relative; | |
// &:hover { | |
// background: rgba(0, 0, 0, 0.15); |
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
fn main() { | |
let mut safety = &String::from("hello"); | |
println!("address of safety {:p}: {}", &safety, safety); | |
{ | |
let name = "xfy".to_string(); | |
let name = expand(&name); | |
println!("address of name {:p}: {}", &name, name); | |
safety = &name; | |
} | |
println!("address of safety {:p}: {}", &safety, safety); |
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
use anyhow::{anyhow, Context}; | |
use tokio::task; | |
use argon2::password_hash::SaltString; | |
use argon2::{password_hash, Argon2, PasswordHash, PasswordHasher, PasswordVerifier}; | |
pub async fn hash(password: String) -> anyhow::Result<String> { | |
task::spawn_blocking(move || { | |
let salt = SaltString::generate(rand::thread_rng()); | |
Ok(Argon2::default() |
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
git log --since="2023-01-01" --until="2023-12-31" --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 5 |
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
pub async fn read_headers<R>(reader: R) -> Result<String> | |
where | |
R: AsyncRead + std::marker::Unpin, | |
{ | |
let mut request_string = String::new(); | |
let mut reader = BufReader::new(reader); | |
loop { | |
let byte = reader.read_line(&mut request_string).await?; | |
if byte < 3 { | |
break; |
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
use std::{collections::HashMap, future::Future}; | |
pub struct Rymo<'a, F, Fut> | |
where | |
F: FnOnce() -> Fut + 'static + Send + Sync, | |
Fut: Future<Output = ()>, | |
{ | |
pub port: String, | |
pub handle: HashMap<&'a str, F>, | |
} |
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
use super::error::{RouteError, RouteResult}; | |
use crate::AppState; | |
use anyhow::{anyhow, Result}; | |
use axum::{ | |
body::Body, | |
extract::{Request, State}, | |
http::{response::Parts, HeaderName, HeaderValue, Uri}, | |
response::{IntoResponse, Response}, | |
}; | |
use http_body_util::BodyExt; |
NewerOlder