RC Day 28

I’ve been thinking over the challenge of writing an OS in JavaScript, and I want to try revisiting it.   Today, going back to the basics of computing, I made a Node app that works as a virtual logic gate emulator, with a “punchcard” input / output system. –> Running here: https://computor.herokuapp.com/ –> Source code […]

Read More RC Day 28

RC Day 27

Today I refactored the two state machines in Tiny Node Browser, the tokenizer and layout renderer, to use switch statements on the top level of their nested if-else statements. I think there’s still more room for improvement, though. This StackOverflow post on implementing simple state machines points out a few different patterns, which I’d like […]

Read More RC Day 27

RC Day 26

A fellow RC-er asked me a seemingly-simple question today: “How do I access a locally hosted static file from a JS script running on a webpage?” If it were a script running on the server, it’d be as easy as using Node’s built-in file system library, fs. If it were an externally-hosted file, you’d grab […]

Read More RC Day 26

Day 25

I wrote up a gist implementing quicksort:¬†https://gist.github.com/slohmes/85a803d5d77811b2fcabc2b5e0feac1e   I also went over the foundational object-oriented programming concepts (inheritance, polymorphism, abstraction, encapsulation) trying to figure out how they map from Java to JavaScript. As an object-oriented language, Java has a language-level notion of classes and objects, and the language itself includes an object-oriented inheritance system. You […]

Read More Day 25

RC Day 23

I spent the day working with an RC batchmate to set up a Mac VM on his Windows laptop! It turns out this is a pretty complicated process, and I’m hoping to do a full blog post on that. As a summary, I drew these diagrams:   The highlight of the day was finding out […]

Read More RC Day 23

RC Day 22

I spent the day brushing up on quicksort, the recursive, in-place, average O(n log n) sort algorithm! While writing up an implementation, I dove deeper into JavaScript’s weird [].push()¬† / [].concat() behavior disparity.   x.push() modifies the array and returns the length of the appended array. x.concat() does not modify the array and returns the […]

Read More RC Day 22