This project presents a tiny JavaScript PubSub implementation weighing in at a mere 163 bytes. It provides basic publish and subscribe functionality, allowing developers to broadcast messages on specific topics (strings) and have subscribed functions execute when those topics are published to. The library focuses on extreme minimalism, sacrificing features like wildcard subscriptions or complex message filtering for an incredibly small footprint. This makes it suitable for resource-constrained environments or situations where a full-fledged PubSub library would be overkill.
FlashSpace is a free and open-source macOS application designed as a faster, more lightweight alternative to the built-in Spaces feature. It aims to provide smoother and more responsive virtual desktop switching, reducing lag and improving overall performance compared to the native solution. The project is hosted on GitHub and welcomes contributions.
Hacker News users generally praised FlashSpace for its speed and open-source nature, seeing it as a welcome alternative to the built-in macOS Spaces feature. Several commenters expressed interest in features like window previews within the Spaces overview and better integration with keyboard shortcuts. Some questioned the app's stability and long-term maintenance given it's a solo project. There was also discussion about existing window management alternatives and their respective strengths and weaknesses compared to FlashSpace, with mentions of yaba, Rectangle, and Amethyst. A few users shared their own experiences with similar personal projects and the challenges of balancing feature requests with maintainability.
This project demonstrates a surprisingly functional 3D raycaster engine implemented entirely within a Bash script. By cleverly leveraging ASCII characters and terminal output manipulation, it renders a simple maze-like environment in pseudo-3D. The script calculates ray intersections with walls and represents distances with varying shades of characters, creating a surprisingly immersive experience given the limitations of the medium. While performance is understandably limited, it showcases the flexibility and unexpected capabilities of Bash beyond typical scripting tasks.
Hacker News users discuss the ingenuity and limitations of a bash raycaster. Several express admiration for the project's creativity, highlighting the unexpected capability of bash for such a task. Some commenters delve into the technical details, discussing the clever use of shell built-ins and the performance implications of using bash for computationally intensive tasks. Others point out that the "raycasting" is actually a 2.5D projection technique and not true raycasting. The novelty of the project and its demonstration of bash's flexibility are the main takeaways, though its practicality is questioned. Some users also shared links to similar projects in other unexpected languages.
Summary of Comments ( 20 )
https://news.ycombinator.com/item?id=43529774
Hacker News users discussed the minimalist JavaScript pub/sub implementation, praising its small size and cleverness. Some questioned its practicality for complex applications, suggesting larger libraries like mitt might be more suitable due to features like wildcard subscriptions and unsubscribing. Others debated the value of minimizing bundle size in modern web development, with some arguing that 163 bytes is a negligible saving. A few commenters suggested improvements or alternative implementations, including using a Map instead of an object for storing subscriptions to avoid prototype pollution issues. Overall, the reception was positive, though tinged with pragmatic considerations regarding real-world usage.
The Hacker News post discussing the 163-byte JavaScript PubSub implementation has generated several comments, primarily focusing on the code's size, efficiency, and practicality.
One commenter questions the value of such a minimal implementation, arguing that the small size comes at the cost of features and robustness found in more established PubSub libraries. They suggest that using a slightly larger, but more feature-rich library would likely be a better choice in real-world applications. This commenter also raises the point that minification often obscures the actual usefulness and readability of the code, implying that the 163-byte size is less significant than it appears.
Another comment chain discusses the potential drawbacks of using a single global event bus, highlighting the possibility of naming collisions and the difficulty of managing subscriptions in larger applications. They advocate for more structured approaches, such as namespacing or using a library that provides better organization.
One commenter focuses on the potential performance implications, specifically the use of
eval()
for executing the subscriber functions. They raise concerns about the security and efficiency implications of usingeval()
and propose alternative methods that could be more performant and secure.Further discussion revolves around alternative small PubSub implementations, with users sharing links to similar projects and comparing their sizes and features. Some commenters appreciate the minimalist approach and see the code as an interesting demonstration of how concise JavaScript can be. They acknowledge that while it may not be suitable for complex applications, it could be useful for smaller projects or educational purposes.
A few comments dive into the specific code details, suggesting potential optimizations or pointing out potential issues. For example, one comment mentions the use of the
this
keyword inside the subscriber functions, which might not behave as expected depending on the calling context.Overall, the comments represent a mixture of perspectives, with some praising the brevity of the code while others question its practicality and raise concerns about potential issues. The discussion highlights the trade-offs involved in prioritizing code size over features and maintainability, ultimately suggesting that the choice of a PubSub implementation depends heavily on the specific needs of the project.