Skip to content

Instantly share code, notes, and snippets.

View ErnWong's full-sized avatar
🦆

Ernest Wong ErnWong

🦆
View GitHub Profile
@ErnWong
ErnWong / gui-library-considerations.md
Last active March 22, 2023 07:35
GUI library considerations
  • Drawing:
    • Coordinate System: Pixels, logical pixels, dpi scaling, device-independent pixels, inches, logical inches, dpi logical dpi, points, zoom,
    • Color:
      • rgb, hsv, hsl, etc
      • Colorspaces: Device independent (e.g. sRGB), Deviced dependent (monitor specific)
      • Gamma, linear colorspace
      • High dynamic range, tone-mapping
    • Blending:
      • blend modes
  • Blending in the right colorspace https://observablehq.com/@mootari/color-blending-is-broken
@ErnWong
ErnWong / thicc idris types.md
Created December 12, 2022 06:51
Thicc Idris Types
Main> :r
1/1: Building src.Main (src/Main.idr)
Loaded file src/Main.idr
Main> :ti todo
   input : List Nat
   x : ErasedThing (Equal {a = Nat} {b = Nat} (.fst {type = Nat} {pred = \returnValue : Nat =>
 Equal {a = Nat} {b = Nat} returnValue (foldr {acc = Nat} {elem = Nat} maximum 0 (reverseOnto {a = Nat} ([] {a = Nat}) input))} (let Element {type = returnOut} {pred = \returnValue : returnOut =>
                                                                                                                                       ComposedReturnProof {returnOut} {streamOut = Void} {streamIn = Void} {streamMid = streamIn} {returnMid = ()} (fromListReturnInvariant {streamOut = streamIn} list) (ExhaustsInputAnd {returnOut} {streamOut = Void} {streamIn} returnInvariant) (Yes () ()) ([] {a = Void}) ([] {a = Void}) returnValue} returnValue proofs =
                                                                                                                                       .runIdentity {a = Subset Nat (\ret
namespace thisWorks
testMyErased : Exists {type = (Nat, String)} (\y => (String, (Nat, Nat)))
0 testMyUse : String
testMyUse = Builtin.fst $ snd $ testMyErased
0 testMyUse2 : (Nat, Nat)
testMyUse2 = Builtin.snd $ snd testMyErased
error[E0599]: no function or associated item named `generatee_random` found for struct `ConsCell` in the current scope
--> src/main.rs:803:36
|
66 | struct ConsCell<ElementType, TypeListType: TypeList>(ElementType, TypeListType);
| ---------------------------------------------------- function or associated item `generatee_random` not found for this struct
...
803 | println!("{}", EnglishGrammar::generatee_random::<Sentence>());
| ^^^^^^^^^^^^^^^^ function or associated item not found in `ConsCell<(Sentence, ConsCell<ConsCell<NounPhrase, ConsCell<VerbPhrase, ConsCell<Terminal<".">, Empty>>>, ConsCell<ConsCell<VerbPhrase, ConsCell<Terminal<".">, Empty>>, ConsCell<ConsCell<AuxiliaryVerb, ConsCell<NounPhrase, ConsCell<VerbPhrase, ConsCell<Terminal<"?">, Empty>>>>, Empty>>>), ConsCell<(ComplementizerPhrase, ConsCell<ConsCell<Complementizer, ConsCell<Sentence, Empty>>, Empty>), ConsCell<(PrepositionalPhrase, ConsCell<ConsCell<Preposition, ConsCell<NounPhrase, E
import java.util.function.Function;
// Learning exercise - porting the following ideas:
// https://github.com/moonad/FormCoreJS/blob/master/FormCore.js
// https://github.com/Soonad/Formality-Core/blob/master/Whitepaper.md
// https://github.com/Kindelia/Kind/blob/master/base/Kind/Core.kind
// https://github.com/yatima-inc/yatima-lang-alpha/blob/main/core/src/term.rs
// TODO

Disclaimer: I have no idea what I'm doing. This gist is a scratchpad for me to hopefully one make sense of things. Expect nonsensical notes jotted on this page.

trait X {
type X;
fn f() -> Self::X;
}
trait Y {
type Y;
fn f(y: Self::Y);
}
trait XY {
type X: X;
@ErnWong
ErnWong / dango.log
Created June 15, 2021 11:04
CrystalOrb: Crash report - Unexpected status change into: Blending(0.0)
​ INFO server/src/main.rs:89 Starting server - listening at ws://dango-daikazoku.herokuapp.com/host
​ WARN /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crystalorb-0.2.1/src/fixed_timestepper.rs:184 Timestamp has drifted by -0.3378999990000011 seconds. This should not happen too often.
​ WARN /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crystalorb-0.2.1/src/fixed_timestepper.rs:195 Attempted to advance more than the allowed delta seconds (0.3378999990000011). This should not happen too often.
​ Server listening to new WebRTC connections...
​ Waiting for connections via websocket relay...
​ WARN /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crystalorb-0.2.1/src/fixed_timestepper.rs:184 Timestamp has drifted by -0.08789999900000112 seconds. This should not happen too often.
​ INFO server/src/main.rs:109 Found endpoint id
​ INFO client/src/main.rs:150 Starting client - connecting to http://dango-daikazoku.herokuapp.com/join/FAbdJmojnG4_37GyK_oLl
​ INFO patches/bevy_w
mod borrow_method {
use std::borrow::{Borrow, BorrowMut};
pub struct Inner {
x: i32,
}
impl Inner {
pub fn new() -> Self {
Inner { x: 0 }
}