Testing Your Knowledge Of JavaScript’s Date Class

JavaScript is everywhere these days, even outside the browser. Everyone knows that this is because JavaScript is the best programming language, which was carefully assembled by computer experts and absolutely not monkeyed together in five days by some bloke at Netscape in the 90s. Nowhere becomes this more apparent than in aspects like JavaScript’s brilliantly designed Date class, which astounds people to this day with its elegant handling of JavaScript’s powerful type system. This is proudly demonstrated by the JS Date quiz by [Samwho].

Recently [Brodie Robertson] decided to bask in the absolute glory that is this aspect of JavaScript, working his way through the quiz’s 28 questions as his mind gradually began to crumble at the sheer majesty of this class’ elegance and subtle genius. Every answer made both logical and intuitive sense, and left [Brodie] gobsmacked at the sheer realization that such a language was designed by mere humans.

After such a humbling experience, it would only seem right to introduce the new JS convert to the book JavaScript: The Good Parts, to fully prepare them for their new career as a full-stack JS developer.

Continue reading “Testing Your Knowledge Of JavaScript’s Date Class”

Explore The Granddaddy Of All Macs With LisaGUI

Sure, Apple’s Lisa wasn’t the first computer released with a graphical user interface — Xerox was years ahead with the Alto and the Star workstation — but Lisa was the first that came within the reach of mere mortals. Which doesn’t mean many mortals got their hands on one; with only about 10,000 sold, they were never common, and are vanishingly rare nowadays. Enter [Andrew Yaros], who has graced the world with LisaGUI, an in-browser recreation of the Lisa Office System in Javascript.

Lisa’s GUI varies from modern conventions in a few interesting ways. For one, it is much more document-focused: if you double-click on LisaType, you do not start the program. Instead you “tear off” a document from the “pad” icon of LisaType, which you can then open with another double click. The desktop is also not a folder for files to live permanently, but a temporary space. You can “set aside” a file to the desktop, but its home on disk is unchanged.

Unlike the family of Mac emulators, LisaGUI does not purport to be a perfect replica. [Andrew] has made a few quality-of-life improvements for modern users, as well as a few innovations of his own. For instance, menus are now “sticky”– on the Lisa, you had to hold down the mouse to keep them open, and release on the appropriate entry. LisaGUI leaves the menu open for you to click the entry, as on a later Macintosh.

Obviously the menu bar clock and FPS counter are not native to the Lisa; nor is the ability to theme the icons and change (1-bit) colour palettes. The ability to draw unique icons to assign to documents is all [Andrew], but is something we wish we had back in the day. He also makes no attempt to enforce the original aspect ratio, so you’ll be dragging the window to get 4:3 if that’s your jam.

Right now it does not look as though there’s much original software aside from LisaType. We would have loved to see the famous LisaProject, which was the original “killer app” that led NASA to purchase the computer. Still, this is an Alpha and it’s possible more software is to come, if it doesn’t run afoul of Apple’s IP. Certainly we are not looking too hard at this gift horse’s chompers. What’s there is plenty to get a feel for the system, and LisaGUI should be a treat for retrocomputer enthusiasts who aren’t too anal about period-perfect accuracy.

We stumbled across this one in a video from [Action Retro] in which he (the lucky dog) also shows off his Lisa II, the slightly-more-common successor.

Screenshot of Linux in a PDF in a browser

Nice PDF, But Can It Run Linux? Yikes!

The days that PDFs were the granny-proof Swiss Army knives of document sharing are definitely over, according to [vk6]. He has managed to pull off the ultimate mind-bender: running Linux inside a PDF file. Yep, you read that right. A full Linux distro chugging along in a virtual machine all encapsulated within a document. Just when you thought running DOOM was the epitome of it. You can even try it out in your own browser, right here. Mind-boggling, or downright Pandora’s box?

Let’s unpack how this black magic works. The humble PDF file format supports JavaScript – with a limited standard library, mind you. By leveraging this, [vk6] managed to compile a RISC-V emulator (TinyEMU) into JavaScript using an old version of Emscripten targeting asm.js instead of WebAssembly. The emulator, embedded within the PDF, interfaces with virtual input through a keyboard and text box.

The graphical output is ingeniously rendered as ASCII characters – each line displayed in a separate text field. It’s a wild solution but works astonishingly well for something so unconventional.

Security-wise, this definitely raises eyebrows. PDFs have long been vectors for malware, but this pushes things further: PDFs with computational power. We know not to trust Word documents, whether they just capable of running Doom, or trash your entire system in a blink. This PDF anomaly unfolds a complete, powerful operating system in front of your very eyes. Should we think lightly, and hope it’ll lead to smarter, more interactive PDFs – or will it bring us innocent looking files weaponized for chaos?

Curious minds, go take a look for yourself. The project’s code is available on GitHub.

Continue reading “Nice PDF, But Can It Run Linux? Yikes!”

DIY 3D Hand Controller Using A Webcam And Scripting

Are you ready to elevate your interactive possibilities without breaking the bank? If so, explore [Caio Bassetti]’s tutorial on creating a full 3D hand controller using only a webcam, MediaPipe Hands, and Three.js. This hack lets you transform a 2D screen into a fully interactive 3D scene—all with your hand movements. If you’re passionate about low-cost, accessible tech, try this yourself – not much else is needed but a webcam and a browser!

The magic of the project lies in using MediaPipe Hands to track key points on your hand, such as the middle finger and wrist, to calculate depth and positioning. Using clever Three.js tricks, the elements can be controlled on a 3D axis. This setup creates a responsive virtual controller, interpreting hand gestures for intuitive movement in the 3D space. The hack also implements a closed-fist gesture to grab and drag objects and detects collisions to add interactivity. It’s a simple, practical build and it performs reliably in most browsers.

For more on this innovation or other exciting DIY hand-tracking projects, browse our archive on gesture control projects, or check out the full article on Codrops. With tools such as MediaPipe and Three.js, turning ideas into reality gets more accessible than ever.

Lunar Lander Game Asks You To Write A Simple Autopilot

Everyone likes a good lunar landing simulator, and [Dominic Doty] wrote a fun take on the idea: your goal is to write an autopilot controller to manage the landing. Try it out!

Virtual landers are far cheaper than real ones, thank goodness.

[Dominic] was inspired in part by this simple rocket landing game which is very much an exercise in reflex and intuition, not to mention being much faster-paced than the classic 1979 video game (which you can also play in your browser here.)

[Dominic]’s version has a similar classic look to the original, but embraces a more thoughtful approach. In it, one uses plain JavaScript to try to minimize the lander’s angle, velocity, and angular velocity in order to land safely on the generated terrain.

Want to see if you have the right stuff? Here’s a direct link to Lunar Pilot. Don’t get discouraged if you don’t succeed right away, though. Moon landings have had plenty of failures, and are actually very hard.

Turning Horrible Browser Controls Into A Game

With all of the various keyboards, mouses (mice?), and other human interface devices (HID) available for our computers, there’s no possible way for developers to anticipate every type of input for every piece of software they build. Most of the time everything will work fine as long as some basic standards are kept, both from the hardware and software sides, but that’s not always the case. [Losso] noticed a truly terrible volume control method when visiting certain websites while also using a USB volume knob, and used this quirk to build a Breakout game with it.

It turns out his volume control knob would interact simultaneously with certain video players’ built-in volume control and the system volume for the operating system, leading to a number of undesirable conditions. However, the fact that this control is built in to certain browsers in the first place led to this being the foundation for the Breakout clone [Losso] is calling KNOB-OUT. Unlike volume buttons on something like a multimedia keyboard, the USB volume control knob can be configured much more easily to account for acceleration, making it more faithful to the original arcade version of the game. The game itself is coded in JavaScript with the source code available right in the browser.

If you’d like to play [Losso]’s game here’s a direct link to it although sometimes small web-based projects like these tend to experience some slowdown when they first get posted here. And, if you’re looking for some other games to play in a browser like it’s the mid-00s again, we’re fans of this project which brings the unofficial Zelda game Zelda Classic to our screens.

Play Giant Tetris On Second-Floor Window

Sometimes it seems like ideas for projects spring out of nothingness from a serendipitous set of circumstances. [Maarten] found himself in just such a situation, with a combination of his existing Tetris novelty lamp and an awkwardly-sized window on a second-floor apartment, he was gifted with the perfect platform for a giant playable Tetris game built into that window.

To make the giant Tetris game easily playable by people walking by on the street, [Maarten] is building as much of this as possible in the browser. Starting with the controller, he designed a NES-inspired controller in JavaScript that can be used on anything with a touch screen. A simulator display was also built in the browser so he could verify that everything worked without needing the giant display at first. From there it was on to building the actual window-sized Tetris display which is constructed from addressable LEDs arranged in an array that matches the size of the original game.

There were some issues to iron out, as would be expected for a project with this much complexity, but the main thorn in [Maarten]’s side was getting his controller to work in Safari on iPhones. That seems to be mostly settled and there were some other gameplay issues to solve, but the unit is now working in his window and ready to be played by any passers-by, accessed by a conveniently-located QR code. Tetris has been around long enough that there are plenty of unique takes on the game, like this project from 2011 that uses Dance Dance Revolution pads for controllers.