Rägnar O'ock
KPCKevin Powell - Community
•Created by Rägnar O'ock on 8/21/2024 in #resources
Design patterns for complex applications
https://gameprogrammingpatterns.com/
A game is nothing more than a complex application that just happens to be entertaining (at least it should be...), so knowing how some of the systems usually used in game dev can usefull when you need to implement complex logic. This web site explains those design patterns in a easy to understand way (at least its easier than most other resources I came across...). Those can be used for frontend as well as backend code.
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 8/7/2024 in #front-end
Help me understanding how a type works
I'm currently trying to understand how Tiptap 's
CommandManager
works and especially how the commands are strongly typed.
I have extracted the type declarations required to have the strong and dynamic typing of the commands handled by the CommandManager
. I understand all but one of the types involved and it's the UnionToIntersection
type (see attached typescript playground).
While I see what this type does, I don't understand how it does it, if anyone can help me crack this code it would be great.
Basically this type turns Unions of types like this one :
into Intersections of types like this one :
2 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 3/20/2024 in #resources
"How should I expose errors in my API?" there's an RFC for that
RFC 9457 : https://www.rfc-editor.org/rfc/rfc9457.html
This is mainly for backend people or frontenders that dabbles in creating APIs.
This RFC describes how errors should be reported by the servers in the context of REST APIs. This allows for a normalized way of exposing errors for both the human that needs to work with the API (you) and the code that needs to handle failed requests.
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 3/20/2024 in #resources
Things you might not know about Git (part 2)
A while ago I shared a talk about things you might not know about git (https://discord.com/channels/436251713830125568/1207093328458424320)...
well, the guy did a followup, so there it is :
https://youtu.be/Md44rcw13k4?si=ahBTP8geHgkhWBdy
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 3/9/2024 in #resources
Blur and ideas on how to use it in your designs
3 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 2/13/2024 in #resources
things you might not know about git
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 1/10/2024 in #resources
Designing for dark mode
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 12/24/2023 in #resources
functional programming is great, use it (1)
https://youtu.be/nuML9SmdbJ4?si=GML_Ssq9dTuMHl81
(1) when applicable (2) and when the resulting code is more concise and easier to read
(2) except if it involves recursion
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 12/16/2023 in #resources
TSConfig Cheat Sheet
(and all of that guys content really)
https://youtu.be/eJXVEju3XLM?si=tB5NxO91r5y26u-U
2 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 11/23/2023 in #resources
A set of style focused rules to format with eslint
What the title says.
With the deprecation of formating focussed rules from the default set of rules that ships with eslint, I thought I would need to find something else to format my code the way I like it.
Unfortunately, after searching for a bit, I realized that a tool as configurable and powerful as eslint was nowhere to be found... Until I found this project that aims at doing just that, formating with eslint :
https://eslint.style/
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 9/29/2023 in #resources
A convention for commit messages that you can use
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 8/4/2023 in #resources
Software design pattern : dependency injection
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 7/20/2023 in #resources
WebGL fundamentals
I wish I knew about this website earlier this week...
https://webglfundamentals.org/webgl/lessons/webgl-fundamentals.html
4 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 4/25/2023 in #resources
Container query example
1 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 3/19/2023 in #resources
Monads in Typescript
A nice, in depth article about how Monads can be implemented and used in typescript.
https://medium.com/flock-community/monads-simplified-with-generators-in-typescript-part-1-33486bf9d887
9 replies
KPCKevin Powell - Community
•Created by Rägnar O'ock on 3/7/2023 in #front-end
Is it possible to combine the "Pool Design Pattern" and the "Immutable Design Pattern" in JS?
I'm working within a complex application that uses a lot of new instances of a given class in big loops (multiple million iterations per frame for image processing). To mitigate the (huge) impact on performances that the use of the garbage collector would provoke I am using the "Pool Design Pattern" (tl;dr: reusing the same instances when they are not used anymore to prevent garbage collection and the creation of new instances). The issue is, I need to apply a lot a consecutive operations on my instances, so to make sure I'm using an instance that has the value that I need at any given moment I want to add Immutability to the mix (tl;dr: when created, an instance's values can't be modified).
If I want the pool of object to work I need to send the instances back to it (recycling). The process would look something like :
That is all good if we assume that both
.transformInSomeWay(someValue)
and .transformInSomeOtherWay(someOtherValue)
are mutating myObject
(changing it's internal state). But that means, if I ever need to use retrieve an object, pass it to some other piece of code (maybe async code) and then do some other things with it, I need to be sure to copy that object before doing anything, otherwise I might be working with an object that has already been modified, leading to incorrect result (and it's a nightmare to debug).
To prevent that, I want to use the Immutability Design Pattern (tl;dr: once created an object's state cannot be modified). Getting it to work with the instantiation and recycling process is rather trivial as I would not use Object.freeze()
but simply make the state private in TS. [to be continued in thread...]17 replies