Skip to content

Instantly share code, notes, and snippets.

View Wyatex's full-sized avatar
👋
🐟

樱吹雪 Wyatex

👋
🐟
View GitHub Profile
@Wyatex
Wyatex / event-source-parse.ts
Created September 24, 2025 10:08
EventSourceParse
// Make this a type to override ReadableStream's async iterator type in case
// the popular web-streams-polyfill is imported - the supplied types
// in that case don't quite match.
export type IterableReadableStreamInterface<T> = ReadableStream<T> &
AsyncIterable<T>
/*
* Support async iterator syntax for ReadableStreams in all environments.
* Source: https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
@Wyatex
Wyatex / autocannon-test1.ts
Last active September 27, 2024 09:59
压测
import autocannon from "autocannon";
import * as xlsx from "xlsx";
const connections = [10, 50, 100];
const url = "http://localhost:9999/getList";
const method = "POST";
const body = { topWeight: "1", pageNum: "1", pageSize: 5 };
const headers = { "Content-Type": "application/json" };
const duration = 10;
const xlsxName = "test.xlsx";
@Wyatex
Wyatex / App.js
Created May 23, 2024 06:33
react井字棋课后作业
import { useState } from 'react'
function Square({ value, onSquareClick, hightline }) {
return (
<button className="square" onClick={onSquareClick}>
<span style={{ color: hightline ? 'red' : 'black' }}>{value}</span>
</button>
)
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>双层波浪动画特效</title>
<style>
.header {
@Wyatex
Wyatex / course1.dart
Created October 24, 2023 15:11
LearnFlutter
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
const res = await axios.get('xxx', {
responseType: 'blob'
})
const filename = decodeURIComponent(
res.headers['content-disposition'].split('filename=')[1].split('.xlsx')[0] + ".xlsx"
)
const dom = document.createElement("a")
dom.style.display = "none"
dom.download = filename
dom.href = URL.createObjectURL(res.data);
<div class="container">
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M 400 160 A 2 2 90 0 0 260 160 A 2 2 90 0 0 120 160 C 120 230 260 270 260 350 C 260 270 400 230 400 160" class="line" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M 400 160 A 2 2 90 0 0 260 160 A 2 2 90 0 0 120 160 C 120 230 260 270 260 350 C 260 270 400 230 400 160" class="line line2" />
</svg>
</div>
<style>
@Wyatex
Wyatex / 88w
Created October 26, 2021 12:02
go
package main
import (
"bufio"
"bytes"
"fmt"
"os"
"runtime/pprof"
"strconv"
"sync"
@Wyatex
Wyatex / tailwind-1
Last active October 27, 2021 01:47
tailwind试用
<div class="container mx-auto my-4">
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.websurfmedia.com%2Fwp-content%2Fuploads%2F2017%2F10%2F45.Simply-Apple.jpg&refer=http%3A%2F%2Fwww.websurfmedia.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637759018&t=811575800155c93c3c831f896d8a5c50" class="rounded shadow-lg w-full" />
<div class="my-8 border rounded shadow-lg sm:flex sm:flex-wrap overflow-hidden">
<div class="p-6 border-b sm:w-1/2 sm:border-r md:w-1/4 md:border-b-0 hover:bg-gray-800 group">
<h2 class="title">Lorem, ipsum dolor sit amet consectetur.</h2>
<p class="text-gray-500 group-hover:text-white">Totam nobis consectetur sequi praesentium. Et rem labore sed optio ea id dolorem doloribus, modi perspiciatis voluptatibus ullam delectus quidem ratione debitis? Id pariatur veniam facilis voluptates.</p>
</div>
<div class="p-6 border-b sm:w-1/2 md:w-1/4 md:border-b-0 md:border-r hover:bg-gray-800 group">