Skip to content

Instantly share code, notes, and snippets.

View discountry's full-sized avatar
📕
Learning

Disney discountry

📕
Learning
View GitHub Profile
paths
**/*.{ts,tsx}

React Dev Principles

  1. Purity & Architecture
  • Render must be pure/deterministic: same inputs → same JSX.
  • Must be StrictMode-safe: no side effects in render (no mutations/API calls).
  • Keep render logic separate from event handlers.

Software Engineering Philosophy & Development Protocol

1. Global Integrity & Topology

  • System Awareness: Before implementation, map the dependency graph and system topology. Ensure local changes preserve global invariants and do not trigger "Shotgun Surgery."
  • Orthogonality: Design for independence. Ensure that changes in one module do not leak side effects into others. Minimize coupling and maximize cohesion.

2. Intent & Abstraction Hierarchy

  • Intent-Revealing Design: Prioritize human readability and intent over machine cleverness. Use naming that explains "Why" rather than "How."
  • Single Level of Abstraction (SLA): Adhere strictly to the Single Responsibility Principle (SRP). Each function must operate at a consistent level of abstraction and have exactly one reason to change.
// 建议先刷新网页停止旧脚本,再运行此脚本
var autoBilingual = setInterval(function() {
// --- 1. 侦测市场趋势 ---
// 检查是否有向上趋势的图标 (lucide-trending-up)
const marketIsGoingUp = document.querySelector('span svg.lucide-trending-up') !== null;
// --- 2. 制定反向策略 (定义目标关键词) ---
// 逻辑:涨了就买跌/Short,跌了就买涨/Long
let targetKeywords = [];
@discountry
discountry / antigravity.json
Created January 7, 2026 04:08
cursor/antigravity/vscode one key push to git
{
"key": "cmd+enter",
"command": "runCommands",
"args": {
"commands": [
{
"command": "git.stageAll"
},
{
"command": "antigravity.generateCommitMessage"
@discountry
discountry / eth-gas-tracker.js
Created December 20, 2025 13:26
scriptable eth-gas-tracker
// ============================================
// ETH Gas Elite Widget (v6.1 - Enhanced Breathing Room)
// - 1x1 专项优化:显著增加全局边距,提升呼吸感与留白艺术
// - 结构:顶部胶囊价格 + 中部大字 + 底部独立玻璃卡片
// - 背景:彩色高斯模糊弥散背景
// ============================================
const ETHERSCAN_API_BASE = "https://api.etherscan.io/v2/api";
const KEYCHAIN_KEY = "ETHERSCAN_API_KEY_V2";
const BINANCE_PRICE_URL = "https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT";
//@version=6
indicator("BTC-ZEC RSI Div", overlay=true)
// === Inputs ===
symA = input.symbol("BITSTAMP:BTCUSD", "Symbol A")
symB = input.symbol("BITFINEX:ZECUSD", "Symbol B")
res = input.timeframe("", "Resolution (empty = chart)")
rsiLen = input.int(14, "RSI Length", minval=2)
len = input.int(20, "Z-Score Length", minval=10)
smooth = input.int(5, "EMA Smoothing", minval=1)
// scan-polymarket-orderbook.ts
// 运行: npx tsx scan-polymarket-orderbook.ts
// 或: npx ts-node scan-polymarket-orderbook.ts (需安装 ts-node/typescript)
import * as readline from "node:readline";
type PMEvent = { slug?: string; title?: string };
type Market = {
id: string;
question: string;
#!/usr/bin/env bash
set -euo pipefail
# ============================================================
# Binance Klines Evidence Collector (Judicial-grade)
# - 支持 symbol / interval / startTime / endTime / timeZone / limit
# - 自动分页(limit<=1000)
# - 保存:响应头、TLS 证书、DNS、traceroute、(可选)tcpdump
# - 计算 SHA256(每页+合并)、生成 metadata.json、(可选)OpenTimestamps
# - 在证据目录原地初始化 git(快照),打包时排除 .git
bun add puppeteer-core
@discountry
discountry / binance-api-change-log-watch.ts
Last active October 10, 2025 08:08
Binance API Document Watch Dog
// watcher.js
// 每秒抓取 https://developers.binance.com/docs/derivatives/change-log
// 发现正文变化则把“新增/变更的行”发到 Telegram
import fs from 'fs';
import path from 'path';
import process from 'process';
import dotenv from 'dotenv';
import cheerio from 'cheerio';