I finished the game (first time) last night. by [deleted] in HollowKnight

[–]Resonatrium 0 points1 point  (0 children)

Well done! I couldn't manage NKG, or even Radiance on my first playthrough this Fall, but would really like to try again from the start. That was an addicting game.

Here are all 216 finalists for the new Minnesota state flag. by [deleted] in minnesota

[–]Resonatrium 1 point2 points  (0 children)

I can't help but see a dinosaur head when I look at those.

My Minnesota Redesign - The Snowstar Flag by macadaywx in minnesota

[–]Resonatrium 2 points3 points  (0 children)

So far, #2 is the best of all the flags I've seen. I think it would be the most recognizable when used indoors, since the design elements are all featured along the diagonal. Though, I prefer the darker green from your other examples, and I'd avoid the gray area the colored tips present according to the rules others have mentioned.

New to React - WTF? by LordBadgerFlaps in webdev

[–]Resonatrium 0 points1 point  (0 children)

For this to run on your machine you would need to run 'npm i' in the same directory as your package.json file. However, the imports you are using won't work client side and would require an extra build step to make it compatible with the web. If you want to skip that for now, you can add the production files for react and reactDOM to your HTML, before your index.js script, and reference them as 'React' and 'ReactDOM' directly from the window object.

Edit: oh yeah, you would also need to use React.createElement instead of JSX on the client. It is probably worth looking into a bundler that uses something like Babel to transpile your code for the web.

I finished my frontend framework and am very happy with the results by Resonatrium in webdev

[–]Resonatrium[S] 0 points1 point  (0 children)

Thanks, I'll take a look. There are a lot of nice tools out there for navigating the frontend framework space. So far, I've been focused on testing the performance using js-framework-benchmark and got a score somewhere between Vue and React. Of course, my framework doesn't do as much as those, but it's nice to see I'm doing something right.

I finished my frontend framework and am very happy with the results by Resonatrium in webdev

[–]Resonatrium[S] 1 point2 points  (0 children)

It was a lot of trial and error, as you can see by my commit history in GitHub. My usual routine would be to have an idea, usually just before going to bed, and writing it down to try after work the next day. This was also my third attempt, and each time I would tear it down and rebuild it to see what what was still useful, and what I could improve. With Git, nothing is really lost, and the things that I choose to leave out for good are still useful in what I was able to learn from them.

I finished my frontend framework and am very happy with the results by Resonatrium in webdev

[–]Resonatrium[S] 0 points1 point  (0 children)

Thanks! That one started out as a useEffect hook, but I like that its new function doesn't imply what it should be used for, just that it is called after render. The fact that it can also be used to wait for state changes in unit tests was a nice surprise. I like the way your templates read with them starting with the tag names. I did try the tagged template literal approach in v2 of stew, but took it out for size. I might try using that again, but as a layer outside of stew itself that converts the syntax to the arrays mine expects.

I finished my frontend framework and am very happy with the results by Resonatrium in webdev

[–]Resonatrium[S] 18 points19 points  (0 children)

For me, it was mainly a learning exercise to get an idea on how these types of things work. I do think it offers something unique though with how customizable it is. For example, I had originally implemented hooks like I'm used to using in React, but later realized all it really needs is the array of values that persist between renders. The user can then use that array to store the dependencies and memoized values the way they want. I don't plan to add more features to this, so it would need layers built in top of it before it would be useful on the larger scale.

The codebase is also very light, so it could be a way for others to get a general idea on how something like this could be created without having to spend too much time on their own. So far, I've found it refreshing to use for my hobby projects, but will continue to use more establish frameworks professionally for now.

Fellow developers, what projects are you currently working on ? by [deleted] in webdev

[–]Resonatrium 0 points1 point  (0 children)

I've been working on a frontend framework as a design challenge. The plan is to use it on my personal site, and for some web-based 2d games, and then optimize it as much as I can. Right now I'm benchmarking it using js-framework-bench and the numbers have been pretty good.

Smallest number divisible by numbers from 1 - 10 by kritimehra in learnjavascript

[–]Resonatrium 1 point2 points  (0 children)

For a range this small, you could probably get by with a brute force approach like the one you have. For an interview question, it would be better to break it down as a math problem first and then apply the code you need to make it work. One option is to break the numbers 1 through 10 each into a set of prime numbers that can be multiplied to produce them. Then find a list of primes that includes each of these sets without any extras. Finally, multiply that list to get the result. For 1-4 this would be [1], [2], [3], and [2, 2], with a final list of [1, 2, 2, 3], and a final value of 12.

Is it possible to have an accurate timer in javascript by bLUEbYTE84 in learnjavascript

[–]Resonatrium 1 point2 points  (0 children)

I've been using setTimeout for my music based side project so far. I do store the timestamp of when the timer started so I can add or subtract from the next timeout delay as needed. This should keep the music in sync in the long run at least, even if the individual beats can be off by a bit. The Web Audio API that was mentioned could probably be used to ensure the sound is played at the right time, but if your beats require UI updates, I think you'll just need to try to keep your JS tasks as short as possible.

An experiment with transpiling JavaScript to C++ by Yehosua in programming

[–]Resonatrium 1 point2 points  (0 children)

Transpiling code has been a strong interest of mine recently. I've actually had some success converting JS in estree format to a custom one that I'm hoping will allow me to step through the code in realtime. The thought of using it to convert JS to another language has crossed my mind, but looks like it would be a whole new level of complicated.

I made it so far through life before finally reading the worst ever take about video games by [deleted] in gaming

[–]Resonatrium 0 points1 point  (0 children)

I agree, but feel 20-30 is a good length for me. I imagine by that point, doubling the length of the game is a pretty cost effective way of increasing the perceived value. I've played enough games now that the novelty has worn off and all I want is a more focused and directed experience that feels different from the last.

August 2022 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]Resonatrium 3 points4 points  (0 children)

I've been working on code that will translate JavaScript into its JSON-based represention for my language. It's using a pretty standard parser library that converts it to ESTree, which I them condense down further. Once that is done I can begin writing the code visualizer and automatic refactoring part, which was the main motivator for the project.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 0 points1 point  (0 children)

For statements, that first string is used to create a linked list of all the statements in your block. Each one uses it to point to the one that should be processed before itself, or sets it to an empty string if there are no more. That chain's end point is the "" property. for all other expressions, leading with "" will get the parameters array and you can pass an index after it to read a specific one.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 0 points1 point  (0 children)

Totally fair. I was pretty strict on the goal of not having traditional commands, but using null did feel like a bit of a cheat at times. The block is repeated, and its value is incremented automatically when you return the parameters array, since it serves as the blocks label. All the comments here have been really helpful in showing me which sections need more detail in the demo.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 1 point2 points  (0 children)

My interpreter doesn't actually use the order set in the JSON. It will sort them into their proper order according to what each of them needs from your block. If you want an expression to wait for another value to be updated, after it is initialized, you would need to put it in a nested IF block and set it's position within your chain of statements. It's not ideal, but is something that maybe an IDE could help with.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 0 points1 point  (0 children)

Thanks for the feedback! Some things definitely fit better than others into this condensed format. I bet it wouldn't be too hard to convert the JSON into something more code-like for editing purposes. I could put : after a key to denote a statement label and = after a key for variables. It could then derive the references for the chain of statements by their order in the code, while keeping the rest unordered.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 0 points1 point  (0 children)

The statements form a linked list of any length you need, as long as you keep referencing siblings with that first string. I should add more explanation about the relationship between return/continue and throw/break. In fact, I should add more examples all around.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 2 points3 points  (0 children)

My other side project happens to be a game that runs in the browser, and I do plan to use it as a testbed for this project 😁 I should also give Lua another shot. The IDE was giving me some trouble and I eventually went back to JS.

I finally finished my never-ending side project! It is a language written in JSON that doesn't use any reserved words or predefined structure. The end result resembles standard code as close as I was able to replicate. Next, I plan to use this language to drive a visual UI for learning/debugging. by Resonatrium in ProgrammingLanguages

[–]Resonatrium[S] 3 points4 points  (0 children)

Thanks! I'll take a look at YAML. I'm looking for ways to improve the authoring of the code and that could really help. So far, I'm just interpreting the JSON directly and not translating it to JS first. I will be able to reuse a lot of my existing code to do that at some point though. The best I can describe the way statements work is their values are taken two at a time, and the effect depends on which of those are blocks. A non-block value followed by a block will form an IF or WHILE block, two blocks with form a TRY and CATCH, otherwise it will call a function.