Hacker Newsnew | past | comments | ask | show | jobs | submit | douchescript's commentslogin

Nix + flakes & direnv is the perfect dev environment, run it on the Mac and everybody in team can setup any project in seconds. We also have a makefile that sets up Postgres / init,start,stop with a local file socket - so every project instance has it’s own db instance. Very jummy.

That said I wish it was easier to be able to pick a specific build of for example ruby like ruby-3.3.7-p123.


What’s the best way to use JavaScript on rails these days?

I’ve been using rails for over 20 years and still love it but the JavaScript story has always been in flux in bad ways. I don’t like the turbo stuff or stimulus. Basically just want to be able to add some nice charts, and some enhancements like confirmation for links. Basically just build admins with it so the caching for partial html just isn’t part of the game. Looked at upgrading to rails 8 now but the javascript in last version of rails was fragmented and complicated, so looking to find a good way to do it in a standard way now, hopefully next version of rail’s doesn’t change everything again.


just use importmaps

https://guides.rubyonrails.org/working_with_javascript_in_ra...

- Adding npm Packages with importmap-rails To add new packages to your import map-powered application, run the bin/importmap pin command from your terminal:

$ bin/importmap pin react react-dom

Then, import the package into application.js as usual:

import ReactDOM from "react-dom"


It would be a valid thing if there was a documented way to convert a generic node package to import map. Not much stuff in that importmap ecosystem - seems doa.


But how do you integrate and turn on at a specific page/controller view? Look for a specific dom id?


The fragmentation is more an implication of the ever changing landscape of JS frameworks and build tools than Rails.

For me, Stimulus adds just the right amount of structure over Vanilla JS.

And Turbo/Hotwire feels like building skyscrapers with wood vs. steel.


What? No, it's just rails that has changed how it handles JS, or at least the recommended way to handle JS very often throughout the year. It's weird to blame it on the JavaScript ecosystem. Like I can't figure out what changes in the JS ecosystem you are referring to exactly.


Rails has changed it four times in 12 years:

* Prototype

* Asset pipeline

* Webpacker

* Importmaps


There was also the coffeescript romance, that was brief. But maybe earlier.


I prefer Atkinson dithering. I think it preserves more details when the resolution is very low. For more high resolutions floyd-steinberg is better though


Please explain what you mean, atkinson dither loses 1/4 of the error to gain in contrast and details, rendering the top whites washed out. What's your recommended formula for converting the image to gray before dithering


I do prefer always using self.attribute, it’s a little bit longer but there’s no ambiguity. Otherwise you would have to have all props in your head when reading the code.


For considerably long methods you are correct. But the rubonic ideal is shorter methods, and for such short methods, it doesn't provide much in the way of reducing cognitive load. As a reader, if you see no assignment prior to the access of the "prop", then it is a method. The problem comes when you can't fit the whole method on your screen, which is a pretty good rubric for whether you can fit the whole method in your head.


I do like ruby a lot but I never grokked what was so great about _why, even though I coded ruby when he was active. Felt like a cargo cult. Maybe it was the depressive vibe of his stuff.


He was a poet who could code. Not a software engineer.

(disclaimer: I really like most of his ruby stuff)


Same here. I never understood why the poignant guide is so loved. I could never get past the first couple pages cuz it felt so random.

Always thought I was missing something.


No it’s a 32 bit Arm processor most likely. Capable of doing usb and Bluetooth. N-key rollover.


I have one of their kits. Pretty nice kit and fun to build.


14 kB HTTP site. What about the SSL?


I like to use code coverage tools to understand how things work together. Its especially useful with unit tests. You can see every line that was hit all over the codebase for a particular function or api call, with a heat map of line counts. Makes it easy to know what’s important and what’s cruft.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: