Skip to content

Instantly share code, notes, and snippets.

View yuhr's full-sized avatar
💭
sentimental

Sʜɪᴍᴜʀᴀ Yū yuhr

💭
sentimental
View GitHub Profile
@yuhr
yuhr / useSignal.ts
Created April 27, 2023 06:05
Preact Signals, but in React. Licensed under CC0-1.0.
import { useCallback, useSyncExternalStore } from "react"
class Signal<T> {
#value: T
constructor(value: T) {
this.#value = value
}
get value() {
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
let possibilityOfThreshold t =
let a = floor (double t /10.0) |> int
let b = t - a*10 |> int
let s = 1 + sign (b-a)
let ss = sign s
(20-s-a)*a + s*b + ss
for i in [0..100] do
printfn "%d : %d" i (possibilityOfThreshold i)

Keybase proof

I hereby claim:

  • I am yuhr on github.
  • I am yuhr (https://keybase.io/yuhr) on keybase.
  • I have a public key ASDUc8p5YFuMCvtGYsuo4GxN95KrhSd8Lyf89y_RDlUqoQo

To claim this, I am signing this object:

@yuhr
yuhr / macro.ss
Last active March 7, 2024 11:05
macro.ss: Defining macros simply on chez scheme.
#|
macro.ss
Defining macros simply on chez scheme. This code is in the public domain.
|#
(import (scheme))
(define-syntax macro
(syntax-rules ()
((k (name . args) body ...)