Skip to content

Instantly share code, notes, and snippets.

View wei-yuuuu's full-sized avatar

Wei-Yu Chen wei-yuuuu

View GitHub Profile
@wei-yuuuu
wei-yuuuu / contemplative-llms.txt
Created January 20, 2025 03:47 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@wei-yuuuu
wei-yuuuu / DetailedHTMLProps.md
Created January 16, 2025 03:40 — forked from emoxowa/DetailedHTMLProps.md
list of HTML tags and their corresponding types for DetailedHTMLProps

List of HTML Tags and Their Corresponding Props

This is a list of HTML tags and their associated types using the TypeScript DetailedHTMLProps interface. The DetailedHTMLProps interface is a generic type that provides a way to describe HTML element props in a more precise way. The list includes tags from the most commonly used to the least commonly used HTML elements. Each tag is listed in alphabetical order with its associated type definition using the DetailedHTMLProps interface.

  • <a> tag: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
  • <abbr> tag: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
  • <address> tag: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
  • <area> tag: DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>
  • <article> tag: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
  • <aside> tag: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
@wei-yuuuu
wei-yuuuu / updateImageExig.js
Created September 15, 2023 05:41 — forked from CPatchane/updateImageExif.js
getaround-tech-blog_exif-data-manipulation-javascript
// Gist used for this getaround tech article: https://getaround.tech/exif-data-manipulation-typescript/
const getUpdatedImage = (image, onReady) => {
const reader = new FileReader()
reader.addEventListener("load", ({ target }) => {
if (!target) throw new Error("no blob found")
const { result: buffer } = target
if (!buffer || typeof buffer === "string") {
throw new Error("not a valid JPEG")
}
@wei-yuuuu
wei-yuuuu / example.js
Created July 23, 2021 03:43 — forked from coodoo/example.js
一個十分鐘寫的土砲 hotkey manager
useHotkey(['Meta', 'c'], () => {
console.log( `要跑 1`, )
})
useHotkey(['ctrl', 'c'], () => {
console.log( `要跑 2`, )
})
@wei-yuuuu
wei-yuuuu / Classes.js
Created July 23, 2021 03:37 — forked from gaearon/Classes.js
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@wei-yuuuu
wei-yuuuu / GLSL-Noise.md
Created May 7, 2021 18:23 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@wei-yuuuu
wei-yuuuu / _final.md
Created November 2, 2020 06:46 — forked from coodoo/_final.md

前言

這是 Oct. 28 ~ Nov. 01, 2020 間於推特上舉辦的趣味面試挑戰,四天期間共 517 人次閱讀、42 人 fork sandbox,最後收到九份回答,如果這是正式面試,將錄取 5 人、備取 1 人、拒絕 3 人,也就是成功率約六成。

先說結論

  • 面試時別急著跳進去回答問題,先拉高層次觀察問題的形狀,搞清楚 root cause 後再思考答案與解法

  • 過程中多詢問主考官真正想達到的目地、目前為何採取此手法、現在的做法是否遇到困難、有無解法上的限制(time, mem, cpu bound)

@wei-yuuuu
wei-yuuuu / The Rules.md
Created October 11, 2020 03:37 — forked from sebmarkbage/The Rules.md
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@wei-yuuuu
wei-yuuuu / machine.js
Last active July 20, 2020 05:15
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@wei-yuuuu
wei-yuuuu / useSubscription-and-useMutableSource.md
Created May 16, 2020 09:10 — forked from bvaughn/useSubscription-and-useMutableSource.md
`useSubscription` and `useMutableSource` tearing and deopt behavior.

useSubscription and useMutableSource1 tearing and deopt behavior.

Mounting a new tree

The tree below represents a React application mounting. During mount, two components read from an external, mutable source. The first one (List) reads version 1 of that data and the second one (Item) reads version 2.

Deopt

useSubscription (legacy mode)

N/A.